Posts

Showing posts with the label WireMock

Spring Boot WireMock - Testing HTTP clients

Image
In this section, we'll develop a Spring Boot application that connects with a jsonplaceholder client with the help of RestClient and at the end  we will perform integration testing with WireMock  and   JUnit 5 . jsonplaceholder JSONPlaceholder is a free online REST API that we can use whenever we need some fake data. RestClient RestClient is a synchronous client to perform HTTP requests. It is a higher-order API since it performs HTTP requests by using an HTTP client library like the JDK HttpClient, Apache HttpComponents, and others. More Info - click here WireMock WireMock is a popular open-source library for API mock testing. More Info - click here Advantages :      > No load on the remote server.      > Full control over the response.      > Works offline.           JUnit 5 For writing and running unit tests and integration tests for any Java application, the JUnit framework is a great option. It is already included in the spring-boot-starter-test module of Spring Boo