33 lines
745 B
Java
33 lines
745 B
Java
package com.drinkool.services;
|
|
|
|
import static io.restassured.RestAssured.given;
|
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
|
|
import com.drinkool.dtos.AddInventory;
|
|
import com.drinkool.entities.InventoryItemEntity;
|
|
import io.quarkus.test.junit.QuarkusTest;
|
|
import io.restassured.http.ContentType;
|
|
import java.util.UUID;
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
@QuarkusTest
|
|
public class InventoryServiceTest {
|
|
|
|
@Test
|
|
void add() {
|
|
String name = UUID.randomUUID().toString();
|
|
|
|
AddInventory input = new AddInventory();
|
|
input.name = name;
|
|
|
|
given()
|
|
.contentType(ContentType.JSON)
|
|
.body(input)
|
|
.when()
|
|
.post("/api/inventory/create")
|
|
.then();
|
|
|
|
assertEquals(1, InventoryItemEntity.find("name", name).count());
|
|
}
|
|
}
|