This blog post describes how we can configure the Spring MVC Test framework (aka MockMvc) by using the standalone configuration when we are writing unit tests for a Spring MVC REST API. Read More
Programming
Writing Unit Tests for Spring MVC Controllers: Forms
This blog post describes how we can submit a form by using the Spring MVC Test framework, explains how we can ensure that the system under test is working as expected when validation fails, and describes how we can verify that the system under test is working as expected when validation is successful. Read More
Writing Unit Tests for Spring MVC Controllers: Rendering a List
This blog post explains how we can ensure that the system under test returns the correct HTTP status code, describes how we can verify that the system under test renders the correct view, and explains how we can make sure that our model attributes contain the correct information. Read More
Writing Unit Tests for Spring MVC Controllers: Rendering a Single Item
The previous part of my Spring MVC Test tutorial described how we can send HTTP requests to the system under test and write assertions for the response returned by the tested controller method. This blog post describes how we can use the information provided by the previous part of this tutorial when we are writing […] Read More
Writing Assertions With JUnit 5 and AssertJ
This blog post describes how we can write assertions with AssertJ when we are writing tests with JUnit 5. After we have finished this blog post, we: Can get the required dependencies with Maven and Gradle. Know how we can write basic assertions with AssertJ. Understand how we can customize the error message shown when […] Read More
Writing Assertions With JUnit 5 and Hamcrest
This blog post describes how we can write assertions with Hamcrest when we are writing tests with JUnit 5. After we have finished this blog post, we: Can get the required dependencies with Maven and Gradle. Know how we can write basic assertions with Hamcrest. Understand how we can combine multiple Hamcrest matchers. Can customize […] Read More