-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExampleResourceTest.java
49 lines (31 loc) · 1.23 KB
/
ExampleResourceTest.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
49
package org.acme;
import io.quarkus.test.junit.QuarkusTest;
import org.hamcrest.CoreMatchers;
import org.hamcrest.MatcherAssert;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import static io.restassured.RestAssured.given;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
@QuarkusTest
public class ExampleResourceTest {
@Test
public void testHelloEndpoint() {
try {
given()
.when().post("/transaction-test")
.then()
.statusCode(200);
MyEntity entity = (MyEntity) MyEntity.findAll().list().get(0);
MatcherAssert.assertThat(entity.id, CoreMatchers.notNullValue());
MatcherAssert.assertThat(entity.name, CoreMatchers.equalTo("Name"));
MatcherAssert.assertThat(entity.startingTime, CoreMatchers.notNullValue());
MatcherAssert.assertThat(entity.endingTime, CoreMatchers.notNullValue()); // In this point the value is present.
} catch (Exception e) {
e.printStackTrace();
Assertions.fail(e.getMessage());
}
}
}