-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create DeleteUserTest.java and Add test
- Loading branch information
1 parent
41df917
commit b042074
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import io.restassured.builder.RequestSpecBuilder; | ||
import io.restassured.builder.ResponseSpecBuilder; | ||
import io.restassured.http.ContentType; | ||
import io.restassured.specification.RequestSpecification; | ||
import io.restassured.specification.ResponseSpecification; | ||
import org.testng.annotations.BeforeClass; | ||
import org.testng.annotations.Test; | ||
|
||
import static io.restassured.RestAssured.given; | ||
import static org.hamcrest.Matchers.hasSize; | ||
|
||
public class DeleteUserTest { | ||
private static RequestSpecification requestSpecification ; | ||
private static ResponseSpecification responseSpecification ; | ||
@BeforeClass | ||
public static void createRequestSpecification(){ | ||
requestSpecification = new RequestSpecBuilder(). | ||
setBaseUri("https://reqres.in/api"). | ||
build(); | ||
} | ||
@BeforeClass | ||
public static void createResponseSpecification(){ | ||
responseSpecification = new ResponseSpecBuilder(). | ||
expectStatusCode(204). | ||
build(); | ||
} | ||
|
||
@Test | ||
public void validateSuccessfulDeletionOfExistingUserAndCheckStatusCode(){ | ||
given(). | ||
spec(requestSpecification). | ||
when(). | ||
delete("/users/2"). | ||
then(). | ||
assertThat(). | ||
spec(responseSpecification); | ||
} | ||
} |