From 8c5d501f928809d5a5d12d6c560d90096a39a958 Mon Sep 17 00:00:00 2001 From: Szymon Szczubkowski Date: Sun, 21 Jan 2024 01:04:29 +0100 Subject: [PATCH] add: types tests --- src/test/java/org/example/TypesTest.java | 27 ++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/test/java/org/example/TypesTest.java diff --git a/src/test/java/org/example/TypesTest.java b/src/test/java/org/example/TypesTest.java new file mode 100644 index 0000000..55d60a6 --- /dev/null +++ b/src/test/java/org/example/TypesTest.java @@ -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); + } +}