Is there a way to use AssertJ assertions with Spring MVC Test?

I've put together a library that offers AssertJ assertions for MockMvc but also for ResponseEntity (returned by TestRestTemplate): https://github.com/ngeor/yak4j-spring-test-utils


Update

If you would like to vote for inclusion of support for AssertJ assertions with MockMvc, please see the related Spring JIRA issue: SPR-16637.


Generally speaking, you may choose whatever assertion framework you like when testing with Spring.

However, the particular scenario you are describing involves the API of the Spring MVC Test framework. The methods in question are designed to be used with the Hamcrest Matcher API. It is therefore not possible to use AssertJ within those method calls.

Regards,

Sam (author of the Spring TestContext Framework)