How to use MockMvcResultMatchers.jsonPath

I think you need to pass the Matcher to the jsonPath method. For example.

.andExpect(jsonPath("$.version", is("0.1")))

References:
http://docs.spring.io/spring/docs/3.2.x/javadoc-api/org/springframework/test/web/servlet/result/MockMvcResultMatchers.html#jsonPath(java.lang.String,%20org.hamcrest.Matcher)

https://www.petrikainulainen.net/programming/spring-framework/integration-testing-of-spring-mvc-applications-write-clean-assertions-with-jsonpath/

SpringMVC/ mockMVC/ jsonpath compare list of strings

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)