how can I get jsonpath object in mockmvc

206 views Asked by At

I have some test like this:

    @Test
    public void blahFunction() throws Exception {
        mockMvc.perform(post("/api/todo/{id}", 1L)
        )
                .andExpect(status().isOk())
                .andExpect(jsonPath("$.file", is("Lorem ipsum")))
    }
}

I have json response contains file attribute,Now I want to check this file path exist or not,How can I do this, I am wondering does exist something like this:

result = mockMvc.perform...
String filePath = result.jsonpath("$.file")
0

There are 0 answers