add: types tests

This commit is contained in:
Szymon Szczubkowski 2024-01-21 01:04:29 +01:00
parent 051bf5c5a8
commit 8c5d501f92

View File

@ -0,0 +1,27 @@
package org.example;
import io.restassured.RestAssured;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import static io.restassured.RestAssured.given;
import static io.restassured.RestAssured.when;
import static org.hamcrest.Matchers.hasSize;
public class TypesTest {
@BeforeAll
public static void testSetup() {
RestAssured.baseURI = "https://api.magicthegathering.io/v1/types";
}
@Test
public void getAllTypesShouldReturnTwentyFiveElements(){
when().get().then().statusCode(200).body("types", hasSize(25));
}
@Test
public void getTypesWithInvalidPathParamShouldReturnErrorNotFound(){
given().pathParam("id", 1).get("/{id}").then().statusCode(404);
}
}