|
22 | 22 | import org.springframework.context.ApplicationContext;
|
23 | 23 | import org.springframework.core.annotation.AnnotationConfigurationException;
|
24 | 24 | import org.springframework.test.context.TestContext;
|
25 |
| -import org.springframework.test.context.jdbc.SqlConfig.TransactionMode; |
26 | 25 |
|
27 | 26 | import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
28 | 27 | import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
|
|
32 | 31 | import static org.mockito.Mockito.mock;
|
33 | 32 | import static org.springframework.test.context.jdbc.Sql.ExecutionPhase.AFTER_TEST_CLASS;
|
34 | 33 | import static org.springframework.test.context.jdbc.Sql.ExecutionPhase.BEFORE_TEST_CLASS;
|
| 34 | +import static org.springframework.test.context.jdbc.SqlConfig.TransactionMode.ISOLATED; |
35 | 35 |
|
36 | 36 | /**
|
37 | 37 | * Unit tests for {@link SqlScriptsTestExecutionListener}.
|
@@ -71,11 +71,12 @@ void valueAndScriptsDeclared() throws Exception {
|
71 | 71 | BDDMockito.<Class<?>> given(testContext.getTestClass()).willReturn(clazz);
|
72 | 72 | given(testContext.getTestMethod()).willReturn(clazz.getDeclaredMethod("foo"));
|
73 | 73 |
|
74 |
| - assertThatExceptionOfType(AnnotationConfigurationException.class).isThrownBy(() -> |
75 |
| - listener.beforeTestMethod(testContext)) |
76 |
| - .withMessageContaining("Different @AliasFor mirror values") |
77 |
| - .withMessageContaining("attribute 'scripts' and its alias 'value'") |
78 |
| - .withMessageContaining("values of [{bar}] and [{foo}]"); |
| 74 | + assertThatExceptionOfType(AnnotationConfigurationException.class) |
| 75 | + .isThrownBy(() -> listener.beforeTestMethod(testContext)) |
| 76 | + .withMessageContainingAll( |
| 77 | + "Different @AliasFor mirror values", |
| 78 | + "attribute 'scripts' and its alias 'value'", |
| 79 | + "values of [{bar}] and [{foo}]"); |
79 | 80 | }
|
80 | 81 |
|
81 | 82 | @Test
|
@@ -129,9 +130,9 @@ void afterTestClassOnMethod() throws Exception {
|
129 | 130 | }
|
130 | 131 |
|
131 | 132 | private void assertExceptionContains(String msg) throws Exception {
|
132 |
| - assertThatIllegalStateException().isThrownBy(() -> |
133 |
| - listener.beforeTestMethod(testContext)) |
134 |
| - .withMessageContaining(msg); |
| 133 | + assertThatIllegalStateException() |
| 134 | + .isThrownBy(() -> listener.beforeTestMethod(testContext)) |
| 135 | + .withMessageContaining(msg); |
135 | 136 | }
|
136 | 137 |
|
137 | 138 |
|
@@ -160,7 +161,7 @@ public void foo() {
|
160 | 161 |
|
161 | 162 | static class IsolatedWithoutTxMgr {
|
162 | 163 |
|
163 |
| - @Sql(scripts = "foo.sql", config = @SqlConfig(transactionMode = TransactionMode.ISOLATED)) |
| 164 | + @Sql(scripts = "foo.sql", config = @SqlConfig(transactionMode = ISOLATED)) |
164 | 165 | public void foo() {
|
165 | 166 | }
|
166 | 167 | }
|
|
0 commit comments