Skip to content

Commit 95139fc

Browse files
committed
Polishing
1 parent 0afcb4d commit 95139fc

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

spring-test/src/test/java/org/springframework/test/context/jdbc/SqlScriptsTestExecutionListenerTests.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import org.springframework.context.ApplicationContext;
2323
import org.springframework.core.annotation.AnnotationConfigurationException;
2424
import org.springframework.test.context.TestContext;
25-
import org.springframework.test.context.jdbc.SqlConfig.TransactionMode;
2625

2726
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
2827
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
@@ -32,6 +31,7 @@
3231
import static org.mockito.Mockito.mock;
3332
import static org.springframework.test.context.jdbc.Sql.ExecutionPhase.AFTER_TEST_CLASS;
3433
import static org.springframework.test.context.jdbc.Sql.ExecutionPhase.BEFORE_TEST_CLASS;
34+
import static org.springframework.test.context.jdbc.SqlConfig.TransactionMode.ISOLATED;
3535

3636
/**
3737
* Unit tests for {@link SqlScriptsTestExecutionListener}.
@@ -71,11 +71,12 @@ void valueAndScriptsDeclared() throws Exception {
7171
BDDMockito.<Class<?>> given(testContext.getTestClass()).willReturn(clazz);
7272
given(testContext.getTestMethod()).willReturn(clazz.getDeclaredMethod("foo"));
7373

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}]");
7980
}
8081

8182
@Test
@@ -129,9 +130,9 @@ void afterTestClassOnMethod() throws Exception {
129130
}
130131

131132
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);
135136
}
136137

137138

@@ -160,7 +161,7 @@ public void foo() {
160161

161162
static class IsolatedWithoutTxMgr {
162163

163-
@Sql(scripts = "foo.sql", config = @SqlConfig(transactionMode = TransactionMode.ISOLATED))
164+
@Sql(scripts = "foo.sql", config = @SqlConfig(transactionMode = ISOLATED))
164165
public void foo() {
165166
}
166167
}

0 commit comments

Comments
 (0)