Polish Testing chapter regarding @Commit
This commit is contained in:
@@ -826,16 +826,16 @@ after the test method has completed. `@Commit` can be used as a direct replaceme
|
|||||||
|
|
||||||
Indicates whether the transaction for a transactional test method should be __rolled
|
Indicates whether the transaction for a transactional test method should be __rolled
|
||||||
back__ after the test method has completed. If `true`, the transaction is rolled back;
|
back__ after the test method has completed. If `true`, the transaction is rolled back;
|
||||||
otherwise, the transaction is committed. Rollback semantics for integration tests in the
|
otherwise, the transaction is committed (see also `@Commit`). Rollback semantics for
|
||||||
Spring TestContext Framework default to `true` even if `@Rollback` is not explicitly
|
integration tests in the Spring TestContext Framework default to `true` even if
|
||||||
declared.
|
`@Rollback` is not explicitly declared.
|
||||||
|
|
||||||
+
|
+
|
||||||
|
|
||||||
When declared as a class-level annotation, `@Rollback` defines the default rollback
|
When declared as a class-level annotation, `@Rollback` defines the default rollback
|
||||||
semantics for all test methods within the test class hierarchy. When declared as a
|
semantics for all test methods within the test class hierarchy. When declared as a
|
||||||
method-level annotation, `@Rollback` defines rollback semantics for the specific test
|
method-level annotation, `@Rollback` defines rollback semantics for the specific test
|
||||||
method, potentially overriding class-level default rollback semantics.
|
method, potentially overriding class-level `@Rollback` or `@Commit` semantics.
|
||||||
|
|
||||||
+
|
+
|
||||||
|
|
||||||
@@ -3255,7 +3255,7 @@ declarative SQL script execution with default transaction rollback semantics.
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
// overrides the class-level default rollback setting
|
// overrides the class-level @Commit setting
|
||||||
**@Rollback**
|
**@Rollback**
|
||||||
public void modifyDatabaseWithinTransaction() {
|
public void modifyDatabaseWithinTransaction() {
|
||||||
// logic which uses the test data and modifies database state
|
// logic which uses the test data and modifies database state
|
||||||
|
|||||||
Reference in New Issue
Block a user