How to test the Web Layer of your Spring Boot Application with @WebMvcTest

The Web Layer is an interface that enables systems to access the business logic of your application. It is responsible to translate the web-based requests into a format that is used in the core of your system. Also, it transforms the internally used formats into a response that can be sent over the web.
To lower the risk of changing the behavior of your Web Layer by accident, you can use @WebMvcTests.

[Read More]

How to test JSON (de-)serialization in your Spring Boot application with @JsonTest

JSON is a popular data format that is widely used in the communication between systems. Most of the time, I see it being sent with an HTTP request or as the content of a message in a message bus. To ensure the stability of the communication between such systems, it is important that the structure of the JSON does not change without the agreement of both participants. With @JsonTest, Spring Boot contains a handy tool to test the serialization of Java objects into JSON and vice versa.

[Read More]