REST Assured brings the simplicity for Testing and validating REST services in Java.
Here is the full User Guide.
Here is the maven dependency
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>4.3.2</version>
<scope>test</scope>
</dependency>
We will be using Junit5 as Testing support. Here is the dependency for Junit5
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.7.0</version>
<scope>test</scope>
</dependency>
In order to use REST assured effectively it's recommended to statically import methods from the following classes:
import static io.restassured.RestAssured.* ;
import static io.restassured.matcher.RestAssuredMatchers.* ;
import static org.hamcrest.Matchers.* ;
RestAssured Use Hamcrest Matchers for assertions while chaining. Here is the doc for Hamcrest.