Polishing

This commit is contained in:
Sam Brannen
2023-10-05 14:13:01 +02:00
parent 130b1f44f7
commit 913dc86e18
2 changed files with 9 additions and 5 deletions

View File

@@ -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 {
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

View File

@@ -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 {
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 {