MockMvc url path not working after spring 4 to 5

Viewed 37

I'm having below url-pattern in my web.xml

<url-pattern>*.json</url-pattern>

MockMvc setup in spock

    MockMvc mockMvc

    def setup() {
        mockMvc = MockMvcBuilders.standaloneSetup(controller).build()
    }

calling my controller api like below in test case

        def result = mockMvc.perform(get('/test/warning/term.json")
                .contentType(MediaType.APPLICATION_JSON))

term.json is pathVariable in controller method.

this spec worked in spring 4. and when I check in debug mode I received in spring controller api only term in pathVariable String.

after upgrading to spring 5 getting term.json in spring controller api , which is causing the test case failure.

how to fix this?

0 Answers
Related