63 lines
1.7 KiB
Java
63 lines
1.7 KiB
Java
package de.hsos.swa.ma.api.al;
|
|
|
|
import io.quarkus.test.junit.QuarkusTest;
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
//import java.util.UUID;
|
|
|
|
import static io.restassured.RestAssured.given;
|
|
import static org.hamcrest.CoreMatchers.is;
|
|
|
|
@QuarkusTest
|
|
public class MocktailTest {
|
|
|
|
@Test
|
|
public void testCreateSingleEndpoint() {
|
|
//String uuid = UUID.randomUUID().toString();
|
|
String json = "{\"id\":\"0\",\"name\":\"Peter\",\"ingredients\":\"guelle\",\"recipe\":\"ruehren\"}";
|
|
|
|
|
|
given()
|
|
//.pathParam("name", uuid)
|
|
.when().header("Content-Type", "application/json")
|
|
.body(json)
|
|
.post("/mocktail/create/single")
|
|
.then()
|
|
.statusCode(200)
|
|
.body(is("Mocktail wurde erstellt." /* + uuid */));
|
|
}
|
|
|
|
@Test
|
|
public void testUpdateSingleEndpoint() {
|
|
//String uuid = UUID.randomUUID().toString();
|
|
String json = "{\"id\":\"4\",\"name\":\"Peter\",\"ingredients\":\"guelle\",\"recipe\":\"ruehren\"}";
|
|
|
|
|
|
given()
|
|
//.pathParam("name", uuid)
|
|
.when().header("Content-Type", "application/json")
|
|
.body(json)
|
|
.put("/mocktail/update/single")
|
|
.then()
|
|
.statusCode(200)
|
|
.body(is("Mocktail wurde geupdatet." /* + uuid */));
|
|
}
|
|
|
|
@Test
|
|
public void testDeleteSingleEndpoint() {
|
|
//String uuid = UUID.randomUUID().toString();
|
|
String json = "{\"id\":\"3\"}";
|
|
|
|
|
|
given()
|
|
//.pathParam("name", uuid)
|
|
.when().header("Content-Type", "application/json")
|
|
.body(json)
|
|
.delete("/mocktail/delete/single")
|
|
.then()
|
|
.statusCode(200)
|
|
.body(is("Mocktail wurde entfernt." /* + uuid */));
|
|
}
|
|
|
|
}
|