Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Using jayway/JsonPath for validating JSON in MockMvc
- Configuration conf = Configuration.builder()
- .options(Option.AS_PATH_LIST).build();
- MvcResult result = mockMvc.perform(get("<api-endpoint>"))
- .andExpect(status().isOk())
- //.andExpect(jsonPath("$[0]['property']").value(is(0)))
- .andReturn();
- List<String> pathList = JsonPath.using(conf).parse(result.getResponse().getContentAsString()).read("$..*");
- //This pathList will be a list of string for all available JsonPath values "$[0]['property']"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement