Package org.dalesbred.junit
Class TransactionalTests
- java.lang.Object
-
- org.dalesbred.junit.TransactionalTests
-
- All Implemented Interfaces:
org.junit.rules.TestRule
public final class TransactionalTests extends java.lang.Object implements org.junit.rules.TestRuleA JUnitTestRulethat 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 Classes Modifier and Type Class Description static classTransactionalTests.RollbackPolicySpecified the rollback-policy for tests.
-
Constructor Summary
Constructors Constructor Description TransactionalTests(@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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull org.junit.runners.model.Statementapply(@NotNull org.junit.runners.model.Statement base, @NotNull org.junit.runner.Description description)
-
-
-
Constructor Detail
-
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.
-
-