-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix @TestTransaction for self-intercepted invocation
- Loading branch information
Showing
3 changed files
with
79 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...te-orm-panache/src/test/java/io/quarkus/it/panache/TestTransactionOnSingleMethodTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package io.quarkus.it.panache; | ||
|
||
import javax.transaction.Transactional; | ||
|
||
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 only used for a single test method | ||
*/ | ||
@QuarkusTest | ||
@TestMethodOrder(MethodName.class) | ||
public class TestTransactionOnSingleMethodTest { | ||
|
||
@Test | ||
@TestTransaction | ||
public void test1() { | ||
Assertions.assertEquals(0, Beer.find("name", "Lager").count()); | ||
Beer b = new Beer(); | ||
b.name = "Lager"; | ||
Beer.persist(b); | ||
} | ||
|
||
@Test | ||
@Transactional | ||
public void test2() { | ||
Assertions.assertEquals(0, Beer.find("name", "Lager").count()); | ||
Beer b = new Beer(); | ||
b.name = "Lager"; | ||
Beer.persist(b); | ||
} | ||
|
||
@Test | ||
@Transactional | ||
public void test3() { | ||
Assertions.assertEquals(1, Beer.find("name", "Lager").count()); | ||
Beer.deleteAll(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters