Package org.dalesbred.junit
Class TransactionalTests
java.lang.Object
org.dalesbred.junit.TransactionalTests
- All Implemented Interfaces:
org.junit.rules.TestRule
A JUnit
TestRule that can be used to run the test-methods in transactions.
To use the rule, create a database and add the following lines to your test:
@Rule public final TransactionalTests transactionalTests = new TransactionalTests(db);
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumSpecified the rollback-policy for tests. -
Constructor Summary
ConstructorsConstructorDescriptionTransactionalTests(@NotNull javax.inject.Provider<org.dalesbred.Database> db) Constructs a rule that will wrap tests in transactions and use the default rollback-policy (TransactionalTests.RollbackPolicy.ROLLBACK_ON_FAILURE) for rolling back the transaction.TransactionalTests(@NotNull javax.inject.Provider<org.dalesbred.Database> db, @NotNull TransactionalTests.RollbackPolicy rollbackPolicy) Constructs a rule that will wrap tests in transactions and use the specified rollback-policy for rolling back the transaction.TransactionalTests(@NotNull org.dalesbred.Database db) Constructs a rule that will wrap tests in transactions and use the default rollback-policy (TransactionalTests.RollbackPolicy.ROLLBACK_ON_FAILURE) for rolling back the transaction.TransactionalTests(@NotNull org.dalesbred.Database db, @NotNull TransactionalTests.RollbackPolicy rollbackPolicy) Constructs a rule that will wrap tests in transactions and use the specified rollback-policy for rolling back the transaction. -
Method Summary
Modifier and TypeMethodDescription@NotNull org.junit.runners.model.Statementapply(@NotNull org.junit.runners.model.Statement base, @NotNull org.junit.runner.Description description)
-
Constructor Details
-
TransactionalTests
public TransactionalTests(@NotNull @NotNull org.dalesbred.Database db) Constructs a rule that will wrap tests in transactions and use the default rollback-policy (TransactionalTests.RollbackPolicy.ROLLBACK_ON_FAILURE) for rolling back the transaction. -
TransactionalTests
public TransactionalTests(@NotNull @NotNull org.dalesbred.Database db, @NotNull @NotNull TransactionalTests.RollbackPolicy rollbackPolicy) Constructs a rule that will wrap tests in transactions and use the specified rollback-policy for rolling back the transaction. -
TransactionalTests
public TransactionalTests(@NotNull @NotNull javax.inject.Provider<org.dalesbred.Database> db) Constructs a rule that will wrap tests in transactions and use the default rollback-policy (TransactionalTests.RollbackPolicy.ROLLBACK_ON_FAILURE) for rolling back the transaction. -
TransactionalTests
public TransactionalTests(@NotNull @NotNull javax.inject.Provider<org.dalesbred.Database> db, @NotNull @NotNull TransactionalTests.RollbackPolicy rollbackPolicy) Constructs a rule that will wrap tests in transactions and use the specified rollback-policy for rolling back the transaction.
-
-
Method Details
-
apply
@NotNull public @NotNull org.junit.runners.model.Statement apply(@NotNull @NotNull org.junit.runners.model.Statement base, @NotNull @NotNull org.junit.runner.Description description) - Specified by:
applyin interfaceorg.junit.rules.TestRule
-