Skip to content

MockMvc isn't matching handler mappings [SPR-12976] #17567

@spring-projects-issues

Description

@spring-projects-issues

Christopher Smith opened SPR-12976 and commented

I'm trying to run some MockMvc test with the new HtmlUnit support, but for some reason MockMvc isn't matching mappings:

2015-05-04 01:46:33.357  INFO   --- [           main] ilder$StaticRequestMappingHandlerMapping : Mapped "{[/about/{page}/{page2}],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.artsquare.gallery.web.html.StaticPagesHtmlController.aboutDigitization(java.lang.String,java.lang.String)
2015-05-04 01:46:33.366  INFO   --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.test.web.servlet.setup.StubWebApplicationContext@1cc9cfb2
2015-05-04 01:46:33.381 DEBUG   --- [           main] o.s.w.c.s.StandardServletEnvironment     : Adding [servletConfigInitParams] PropertySource with lowest search precedence
2015-05-04 01:46:33.381 DEBUG   --- [           main] o.s.w.c.s.StandardServletEnvironment     : Adding [servletContextInitParams] PropertySource with lowest search precedence
2015-05-04 01:46:33.381 DEBUG   --- [           main] o.s.w.c.s.StandardServletEnvironment     : Adding [systemProperties] PropertySource with lowest search precedence
2015-05-04 01:46:33.381 DEBUG   --- [           main] o.s.w.c.s.StandardServletEnvironment     : Adding [systemEnvironment] PropertySource with lowest search precedence
2015-05-04 01:46:33.381 DEBUG   --- [           main] o.s.w.c.s.StandardServletEnvironment     : Initialized StandardServletEnvironment with PropertySources [servletConfigInitParams,servletContextInitParams,systemProperties,systemEnvironment]
2015-05-04 01:46:33.381  INFO   --- [           main] o.s.mock.web.MockServletContext          : Initializing Spring FrameworkServlet ''
2015-05-04 01:46:33.382  INFO   --- [           main] o.s.t.web.servlet.TestDispatcherServlet  : FrameworkServlet '': initialization started
2015-05-04 01:46:33.382  INFO   --- [           main] o.s.t.web.servlet.TestDispatcherServlet  : FrameworkServlet '': initialization completed in 0 ms
2015-05-04 01:46:34.498  WARN   --- [           main] o.s.web.servlet.PageNotFound             : No mapping found for HTTP request with URI [/about/digitization/comparison] in DispatcherServlet with name ''

Excerpts from Geb spec; can fill in if there's something particular that's needed:

    @Autowired
    StaticPagesHtmlController c

    MockMvc buildMvc() {
        MockMvcBuilders.standaloneSetup(c).build()
    }

    def setup() {
        MockMvc mvc = buildMvc()
        driver = new MockMvcHtmlUnitDriver(mvc, true)
        browser.driver = driver
    }

Affects: 4.1.6

Issue Links:

Metadata

Metadata

Assignees

Labels

in: testIssues in the test modulein: webIssues in web modules (web, webmvc, webflux, websocket)status: declinedA suggestion or change that we don't feel we should currently apply

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions