/** * Start a new test-managed transaction. * <p>Only call this method if {@link #end} has been called or if no * transaction has been previously started. * @throws IllegalStateException if the transaction context could not be * retrieved or if a transaction is already active for the current test * @see #isActive() * @see #end() */ public static void start() { requireCurrentTransactionContext().startTransaction(); }
/** * Immediately force a <em>commit</em> or <em>rollback</em> of the * current test-managed transaction, according to the * {@linkplain #isFlaggedForRollback rollback flag}. * @throws IllegalStateException if the transaction context could not be * retrieved or if a transaction is not active for the current test * @see #isActive() * @see #start() */ public static void end() { requireCurrentTransactionContext().endTransaction(); }
private static void setFlaggedForRollback(boolean flag) { requireCurrentTransactionContext().setFlaggedForRollback(flag); }
@BeforeTransaction @AfterTransaction public void verifyPreAndPostTransactionDatabaseState() { assertNumUsers(0); }
@BeforeTransaction default void beforeTransaction() { invoked(true); } }
@BeforeTransaction public void beforeTransaction() { assertNumUsers(0); }
@BeforeTransaction public void beforeTransaction() { invoked(true); }
@BeforeTransaction public void beforeTransaction() { invoked(true); }
@BeforeTransaction public void beforeTransaction() { invoked(true); }
@BeforeTransaction public void beforeTransaction() { invoked(true); }
@BeforeTransaction public void beforeTransaction() { invoked(true); }
@BeforeTransaction public void beforeTransaction() { invoked(true); }
@BeforeTransaction public void beforeTransaction() { invoked(true); }
@AfterTransaction default void afterTransaction() { invoked(true); } }
@AfterTransaction public void afterTransaction() { invoked(true); }
@AfterTransaction public void afterTransaction() { assertNumUsers(0); }
@MetaAfterTransaction public void afterTransaction() { invoked(true); }
@MetaBeforeTransaction public void beforeTransaction() { invoked(true); }
@MetaTransactional static class TransactionalDeclaredOnClassViaMetaAnnotationTestCase extends AbstractInvocable { @BeforeTransaction public void beforeTransaction() { invoked(true); } public void transactionalTest() { } }
@MetaTxWithOverride(propagation = NOT_SUPPORTED) static class TransactionalDeclaredOnClassViaMetaAnnotationWithOverrideTestCase extends AbstractInvocable { @BeforeTransaction public void beforeTransaction() { invoked(true); } public void transactionalTest() { } }