Browse Source

Polishing

pull/31374/head
Sam Brannen 1 year ago
parent
commit
913dc86e18
  1. 8
      spring-test/src/main/java/org/springframework/test/context/transaction/TestContextTransactionUtils.java
  2. 6
      spring-test/src/test/java/org/springframework/test/context/jdbc/SqlScriptsTestExecutionListenerTests.java

8
spring-test/src/main/java/org/springframework/test/context/transaction/TestContextTransactionUtils.java

@ -35,7 +35,6 @@ import org.springframework.transaction.annotation.TransactionManagementConfigure @@ -35,7 +35,6 @@ import org.springframework.transaction.annotation.TransactionManagementConfigure
import org.springframework.transaction.interceptor.DelegatingTransactionAttribute;
import org.springframework.transaction.interceptor.TransactionAttribute;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils;
/**
@ -270,12 +269,11 @@ public abstract class TestContextTransactionUtils { @@ -270,12 +269,11 @@ public abstract class TestContextTransactionUtils {
super(targetAttribute);
String name = testContext.getTestClass().getName();
if (includeMethodName) {
this.name = ClassUtils.getQualifiedMethodName(testContext.getTestMethod(), testContext.getTestClass());
}
else {
this.name = testContext.getTestClass().getName();
name += "." + testContext.getTestMethod().getName();
}
this.name = name;
}
@Override

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

@ -116,6 +116,9 @@ class SqlScriptsTestExecutionListenerTests { @@ -116,6 +116,9 @@ class SqlScriptsTestExecutionListenerTests {
assertThatIllegalArgumentException()
.isThrownBy(() -> listener.beforeTestMethod(testContext))
.withMessage("@SQL execution phase BEFORE_TEST_CLASS cannot be used on methods");
assertThatIllegalArgumentException()
.isThrownBy(() -> listener.afterTestMethod(testContext))
.withMessage("@SQL execution phase BEFORE_TEST_CLASS cannot be used on methods");
}
@Test
@ -127,6 +130,9 @@ class SqlScriptsTestExecutionListenerTests { @@ -127,6 +130,9 @@ class SqlScriptsTestExecutionListenerTests {
assertThatIllegalArgumentException()
.isThrownBy(() -> listener.beforeTestMethod(testContext))
.withMessage("@SQL execution phase AFTER_TEST_CLASS cannot be used on methods");
assertThatIllegalArgumentException()
.isThrownBy(() -> listener.afterTestMethod(testContext))
.withMessage("@SQL execution phase AFTER_TEST_CLASS cannot be used on methods");
}
private void assertExceptionContains(String msg) throws Exception {

Loading…
Cancel
Save