forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPersonResourceTest.java
48 lines (38 loc) · 1.2 KB
/
PersonResourceTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package com.example.postgresql.devservice;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.List;
import javax.transaction.Transactional;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.RestAssured;
@QuarkusTest
class PersonResourceTest {
@BeforeEach
@Transactional
public void setUp() {
var personOne = new Person();
personOne.age = 27;
personOne.name = "netodevel";
personOne.persist();
var otherPerson = new Person();
otherPerson.age = 27;
otherPerson.name = "fake_name";
otherPerson.persist();
}
@AfterEach
@Transactional
public void tearDown() {
Person.deleteAll();
}
@Test
@DisplayName("given the use of devservices then it should a return a list of persons")
public void shouldReturnListPersons() {
List<Person> personList = RestAssured.get("/persons")
.then()
.extract().jsonPath().getList(".");
assertEquals(2, personList.size());
}
}