From 28496059bca970fddf5591a3dba8533166b4aaf3 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Tue, 21 Sep 2021 10:35:34 +0200 Subject: [PATCH] Make TestNG test methods public due to bug in TestNG TestEngine This commit makes all test methods in our TestNG test classes public due to the following bug in the TestNG engine for the JUnit Platform. https://github.com/junit-team/testng-engine/issues/16 See gh-27407 --- ...AnnotationConfigTestNGSpringContextTests.java | 2 +- ...figTransactionalTestNGSpringContextTests.java | 4 ++-- ...eteTransactionalTestNGSpringContextTests.java | 16 ++++++++-------- .../TestNGApplicationEventsIntegrationTests.java | 4 ++-- ...tExecutionListenerTestNGIntegrationTests.java | 4 ++-- .../testng/web/TestNGSpringContextWebTests.java | 4 ++-- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/spring-test/src/test/java/org/springframework/test/context/testng/AnnotationConfigTestNGSpringContextTests.java b/spring-test/src/test/java/org/springframework/test/context/testng/AnnotationConfigTestNGSpringContextTests.java index f36352cc9ff..f334fb4f110 100644 --- a/spring-test/src/test/java/org/springframework/test/context/testng/AnnotationConfigTestNGSpringContextTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/testng/AnnotationConfigTestNGSpringContextTests.java @@ -48,7 +48,7 @@ public class AnnotationConfigTestNGSpringContextTests extends AbstractTestNGSpri Pet pet; @Test - void autowiringFromConfigClass() { + public void autowiringFromConfigClass() { assertThat(employee).as("The employee should have been autowired.").isNotNull(); assertThat(employee.getName()).isEqualTo("John Smith"); diff --git a/spring-test/src/test/java/org/springframework/test/context/testng/AnnotationConfigTransactionalTestNGSpringContextTests.java b/spring-test/src/test/java/org/springframework/test/context/testng/AnnotationConfigTransactionalTestNGSpringContextTests.java index eadcee96e89..9b324b42d72 100644 --- a/spring-test/src/test/java/org/springframework/test/context/testng/AnnotationConfigTransactionalTestNGSpringContextTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/testng/AnnotationConfigTransactionalTestNGSpringContextTests.java @@ -112,7 +112,7 @@ public class AnnotationConfigTransactionalTestNGSpringContextTests @Test @Transactional(propagation = Propagation.NOT_SUPPORTED) - void autowiringFromConfigClass() { + public void autowiringFromConfigClass() { assertThat(employee).as("The employee should have been autowired.").isNotNull(); assertThat(employee.getName()).isEqualTo("John Smith"); @@ -136,7 +136,7 @@ public class AnnotationConfigTransactionalTestNGSpringContextTests } @Test - void modifyTestDataWithinTransaction() { + public void modifyTestDataWithinTransaction() { assertThatTransaction().isActive(); assertAddPerson(JANE); assertAddPerson(SUE); diff --git a/spring-test/src/test/java/org/springframework/test/context/testng/ConcreteTransactionalTestNGSpringContextTests.java b/spring-test/src/test/java/org/springframework/test/context/testng/ConcreteTransactionalTestNGSpringContextTests.java index 3da61007d1e..f80cc68867a 100644 --- a/spring-test/src/test/java/org/springframework/test/context/testng/ConcreteTransactionalTestNGSpringContextTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/testng/ConcreteTransactionalTestNGSpringContextTests.java @@ -151,7 +151,7 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans @Test @Transactional(propagation = Propagation.NOT_SUPPORTED) - void verifyBeanNameSet() { + public void verifyBeanNameSet() { assertThatTransaction().isNotActive(); assertThat(this.beanName) .as("The bean name of this test instance should have been set to the fully qualified class name due to BeanNameAware semantics.") @@ -160,7 +160,7 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans @Test @Transactional(propagation = Propagation.NOT_SUPPORTED) - void verifyApplicationContextSet() { + public void verifyApplicationContextSet() { assertThatTransaction().isNotActive(); assertThat(super.applicationContext) .as("The application context should have been set due to ApplicationContextAware semantics.") @@ -171,7 +171,7 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans @Test @Transactional(propagation = Propagation.NOT_SUPPORTED) - void verifyBeanInitialized() { + public void verifyBeanInitialized() { assertThatTransaction().isNotActive(); assertThat(beanInitialized) .as("This test instance should have been initialized due to InitializingBean semantics.") @@ -180,7 +180,7 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans @Test @Transactional(propagation = Propagation.NOT_SUPPORTED) - void verifyAnnotationAutowiredFields() { + public void verifyAnnotationAutowiredFields() { assertThatTransaction().isNotActive(); assertThat(nonrequiredLong).as("The nonrequiredLong field should NOT have been autowired.").isNull(); assertThat(pet).as("The pet field should have been autowired.").isNotNull(); @@ -189,7 +189,7 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans @Test @Transactional(propagation = Propagation.NOT_SUPPORTED) - void verifyAnnotationAutowiredMethods() { + public void verifyAnnotationAutowiredMethods() { assertThatTransaction().isNotActive(); assertThat(employee).as("The setEmployee() method should have been autowired.").isNotNull(); assertThat(employee.getName()).as("employee's name.").isEqualTo("John Smith"); @@ -197,20 +197,20 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans @Test @Transactional(propagation = Propagation.NOT_SUPPORTED) - void verifyResourceAnnotationInjectedFields() { + public void verifyResourceAnnotationInjectedFields() { assertThatTransaction().isNotActive(); assertThat(foo).as("The foo field should have been injected via @Resource.").isEqualTo("Foo"); } @Test @Transactional(propagation = Propagation.NOT_SUPPORTED) - void verifyResourceAnnotationInjectedMethods() { + public void verifyResourceAnnotationInjectedMethods() { assertThatTransaction().isNotActive(); assertThat(bar).as("The setBar() method should have been injected via @Resource.").isEqualTo("Bar"); } @Test - void modifyTestDataWithinTransaction() { + public void modifyTestDataWithinTransaction() { assertThatTransaction().isActive(); assertAddPerson(JANE); assertAddPerson(SUE); diff --git a/spring-test/src/test/java/org/springframework/test/context/testng/event/TestNGApplicationEventsIntegrationTests.java b/spring-test/src/test/java/org/springframework/test/context/testng/event/TestNGApplicationEventsIntegrationTests.java index e7f32e5ebc3..67748d84094 100644 --- a/spring-test/src/test/java/org/springframework/test/context/testng/event/TestNGApplicationEventsIntegrationTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/testng/event/TestNGApplicationEventsIntegrationTests.java @@ -72,12 +72,12 @@ class TestNGApplicationEventsIntegrationTests extends AbstractTestNGSpringContex } @Test - void test1() { + public void test1() { assertTestExpectations("test1"); } @Test - void test2() { + public void test2() { assertTestExpectations("test2"); } diff --git a/spring-test/src/test/java/org/springframework/test/context/testng/web/ServletTestExecutionListenerTestNGIntegrationTests.java b/spring-test/src/test/java/org/springframework/test/context/testng/web/ServletTestExecutionListenerTestNGIntegrationTests.java index 9141c93f2e7..6602f00caf4 100644 --- a/spring-test/src/test/java/org/springframework/test/context/testng/web/ServletTestExecutionListenerTestNGIntegrationTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/testng/web/ServletTestExecutionListenerTestNGIntegrationTests.java @@ -57,7 +57,7 @@ public class ServletTestExecutionListenerTestNGIntegrationTests extends Abstract * @see #ensureMocksAreReinjectedBetweenTests_2 */ @Test - void ensureMocksAreReinjectedBetweenTests_1() { + public void ensureMocksAreReinjectedBetweenTests_1() { assertInjectedServletRequestEqualsRequestInRequestContextHolder(); } @@ -67,7 +67,7 @@ public class ServletTestExecutionListenerTestNGIntegrationTests extends Abstract * @see #ensureMocksAreReinjectedBetweenTests_1 */ @Test - void ensureMocksAreReinjectedBetweenTests_2() { + public void ensureMocksAreReinjectedBetweenTests_2() { assertInjectedServletRequestEqualsRequestInRequestContextHolder(); } diff --git a/spring-test/src/test/java/org/springframework/test/context/testng/web/TestNGSpringContextWebTests.java b/spring-test/src/test/java/org/springframework/test/context/testng/web/TestNGSpringContextWebTests.java index 14bead449f1..1ca10f399ba 100644 --- a/spring-test/src/test/java/org/springframework/test/context/testng/web/TestNGSpringContextWebTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/testng/web/TestNGSpringContextWebTests.java @@ -89,7 +89,7 @@ public class TestNGSpringContextWebTests extends AbstractTestNGSpringContextTest } @Test - void basicWacFeatures() throws Exception { + public void basicWacFeatures() throws Exception { assertThat(wac.getServletContext()).as("ServletContext should be set in the WAC.").isNotNull(); assertThat(servletContext).as("ServletContext should have been set via ServletContextAware.").isNotNull(); @@ -114,7 +114,7 @@ public class TestNGSpringContextWebTests extends AbstractTestNGSpringContextTest } @Test - void fooEnigmaAutowired() { + public void fooEnigmaAutowired() { assertThat(foo).isEqualTo("enigma"); }