Skip to content

Commit

Permalink
Restore the ability to use @TestReactiveTransaction on a test class
Browse files Browse the repository at this point in the history
  • Loading branch information
geoand authored and holly-cummins committed Apr 20, 2023
1 parent b7dcabc commit 909a774
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,17 @@
import io.quarkus.hibernate.reactive.panache.Panache;
import io.quarkus.test.TestReactiveTransaction;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.vertx.RunOnVertxContext;
import io.quarkus.test.vertx.UniAsserter;

@QuarkusTest
@TestReactiveTransaction
public class TestReactiveTransactionTest {

@RunOnVertxContext
@TestReactiveTransaction
@Test
public void testTestTransaction(UniAsserter asserter) {
asserter.assertNotNull(() -> Panache.currentTransaction());
}

@RunOnVertxContext
@TestReactiveTransaction
@BeforeEach
public void beforeEach(UniAsserter asserter) {
asserter.assertNotNull(() -> Panache.currentTransaction());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ private boolean shouldContextBeDuplicated(Class<?> c, Method m) {
}
if (runOnVertxContext == null) {
// Use duplicated context if @TestReactiveTransaction is present
return m.isAnnotationPresent(TestReactiveTransaction.class);
return m.isAnnotationPresent(TestReactiveTransaction.class)
|| m.getDeclaringClass().isAnnotationPresent(TestReactiveTransaction.class);
} else {
return runOnVertxContext.duplicateContext();
}
Expand Down

0 comments on commit 909a774

Please sign in to comment.