diff --git a/Sources/API/Quarkus/pom.xml b/Sources/API/Quarkus/pom.xml index 79087f1..8dc1962 100644 --- a/Sources/API/Quarkus/pom.xml +++ b/Sources/API/Quarkus/pom.xml @@ -45,6 +45,17 @@ io.rest-assured rest-assured test + + + + org.mockito + mockito-core + test + + + org.mockito + mockito-junit-jupiter + test diff --git a/Sources/API/Quarkus/src/main/resources/import.sql b/Sources/API/Quarkus/src/main/resources/import.sql index 08c7d4f..c924ccd 100644 --- a/Sources/API/Quarkus/src/main/resources/import.sql +++ b/Sources/API/Quarkus/src/main/resources/import.sql @@ -51,6 +51,9 @@ -- (4, 2, 3, 7); INSERT INTO users (name, password) VALUES ('Alice', 'password123'); +INSERT INTO users (Id, name, Password) VALUES +(2, 'Bob', 'password2'), +(3, 'Charlie', 'password3'); INSERT INTO games (isFinished, nbPoints, time, winner, host_id) VALUES (false, 0, CURRENT_TIMESTAMP, 0, 1); INSERT INTO participe (idGame, position, guestname, totalpoints, iduser) VALUES (1, 1, 'Alice', 0, 1); INSERT INTO round (game_id, idGame, position, turnNumber, points) VALUES (1, 1, 1, 1, 0); diff --git a/Sources/API/Quarkus/src/test/java/org/acme/UserControllerTest.java b/Sources/API/Quarkus/src/test/java/org/acme/UserControllerTest.java index f8438f5..f312421 100644 --- a/Sources/API/Quarkus/src/test/java/org/acme/UserControllerTest.java +++ b/Sources/API/Quarkus/src/test/java/org/acme/UserControllerTest.java @@ -1,7 +1,11 @@ package org.acme; import io.quarkus.test.junit.QuarkusTest; + +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.CsvSource; import static io.restassured.RestAssured.given; import static org.hamcrest.CoreMatchers.is; @@ -9,12 +13,27 @@ import static org.hamcrest.CoreMatchers.is; @QuarkusTest public class UserControllerTest { - @Test - public void testUserEndpoint() { - given() - .when().get("/users/1") - .then() - .statusCode(200); - } + // @Test + // public void testUserEndpoint() { + // given() + // .when().get("/users/1") + // .then() + // .statusCode(200); + // } + + // @Test + // @DisplayName("Test GET /users/{id}") + // @ParameterizedTest(name = "Test with user ID {0}") + // @CsvSource({ + // "2, Bob", + // "3, Charlie" + // }) + // public void testGetUserById(Long id, String expectedName) { + // given() + // .when().get("/users/{id}", id) + // .then() + // .statusCode(200) + // .body("name", equalTo(expectedName)); + // } } \ No newline at end of file