Blog Archives

Spring Controller Unit Testing

This Spring controller unit test is based on

HATEOAS RESTFul Service with Spring tutorial. The request URL and JSON response content are shown below.

REQUEST URL: http://localhost:8080/simpleSpring/greeting?name=John
RESPONSE JSON: {“content”:”Hello, John!”,”links”:[{“rel”:”self”,”href”:”http://localhost:8080/simpleSpring/greeting?name=John”}]}

REQUEST URL: http://localhost:8080/simpleSpring/greeting
RESPONSE JSON:{“content”:”Hello,

Read more ›



Unit Testing Servlet filter with Mockito

This assumes that you have gone through the basic JUnit & Mockito tutorials. Here is test class to “Unit Testing Servlet Filter”. The “HttpServletRequest“, “HttpServletResponse“, “FilterChain“, etc are mocked with Mockito. The Spring also provides classes like “

Read more ›



Java FAQs to Fast-track & Go places

Big Data Engineer FAQs

Java Interview Q&As

Note that some posts belong to multiple categories.
Top