java - Spring MockMvcResultMatchers jsonPath lower/greater than -
i'm using mockmvcresultmatchers test controller classes.
here sample code
requestbuilder request = get("/employee/") .contenttype(mediatype.application_json) .accept(application_json_utf8); mockmvc .perform(request) .andexpect(status().isok()) .andexpect(jsonpath("$.total").exists()); but how can compare $.total value number?
i mean, there way find out $.total > 0?
json path value method can take org.hamcrest.matcher parameter. can use greaterthan class:
jsonpath("['key']").value(new greaterthan(1)) this class org.mockito.internal.matchers package.
Comments
Post a Comment