/
TestTransactionTest.java
44 lines (37 loc) · 1.15 KB
/
TestTransactionTest.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
package io.quarkus.it.panache;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.MethodOrderer.MethodName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import io.quarkus.test.TestTransaction;
import io.quarkus.test.junit.QuarkusTest;
/**
* Tests that @TestTransaction works as expected when used for the entire class
*/
@QuarkusTest
@TestTransaction
@TestMethodOrder(MethodName.class)
public class TestTransactionTest {
@Test
public void test1() {
Assertions.assertEquals(0, Beer.find("name", "Lager").count());
Beer b = new Beer();
b.name = "Lager";
Beer.persist(b);
}
@Test
public void test2() {
Assertions.assertEquals(0, Beer.find("name", "Lager").count());
// interceptor must not choke on this self-intercepted non-test method invocation
intentionallyNonPriveHelperMethod();
Beer b = new Beer();
b.name = "Lager";
Beer.persist(b);
}
@Test
public void test3() {
Assertions.assertEquals(0, Beer.find("name", "Lager").count());
}
void intentionallyNonPriveHelperMethod() {
}
}