Search code examples
springkotlinmodel-view-controllerstatusmockk

What is the import type in springboot mvc mock kotlin, for the status and the isOK


In spring mvc mock kotlin, what is the import class for the status and the isok

thankyou

import ???
@Test
    fun findUser() {
        mockMvc.get("/users?id=99")
            .andExpect {
                status { isOk }
            }

Solution

  • The following should work:

    import org.springframework.test.web.servlet.result.StatusResultMatchers
    
    @Test
    fun findUser() {
      mockMvc.get("/users?id=99")
          .andExpect {
              status { isOk() }
          }
    }