Spring Data MongoDB – Unit Testing using in memory Fongo

This post is about unit testing spring data mongodb using in-memory java implementation of Mongo called Fongo. Complete source code is in github. https://github.com/sanjuthomas/spring-data-mongodb Tools and Libraries used. Fongo (1.1.2) Spring Data MongoDB (1.2.2.RELEASE) Mongo java driver (2.11.0) Junit (4.8.1) Spring Test (3.2.4.RELEASE) No SQL Unit MongoDB (0.7.7) Java 7 We will save and load […]
Continue reading…

 

Unit Testing Spring MVC REST Controllers

Today’s post is about unit testing Spring MVC REST controllers using MockMvcBuilders standalone setup. Complete source code for this post can be cloned from github. Libraries Used pom.xml Controller Code Response Model Object Controller Test Class test-servlet-context.xml Since we are interested to get the response in JSON format we are using Jackson Message Converter.
Continue reading…

 

Spring MVC REST — Unit Testing Post Request

This post is about unit testing Spring MVC REST controller using Spring test framework MockMvcBuilders and junit. The complete source code of this post can be cloned from github. Libraries Used Name Version Spring MVC 4.0 Spring Test 4.0 Junit 4.8.1 Servlet 3.0 Jackson Mapper 1.9.13 Json Path 0.8.1 Controller Code. Response/Request Model Object Controller […]
Continue reading…