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
This commit is contained in:
Sam Brannen 2021-09-21 10:35:34 +02:00
parent 40c51efee8
commit 28496059bc
6 changed files with 17 additions and 17 deletions

View File

@ -48,7 +48,7 @@ public class AnnotationConfigTestNGSpringContextTests extends AbstractTestNGSpri
Pet pet; Pet pet;
@Test @Test
void autowiringFromConfigClass() { public void autowiringFromConfigClass() {
assertThat(employee).as("The employee should have been autowired.").isNotNull(); assertThat(employee).as("The employee should have been autowired.").isNotNull();
assertThat(employee.getName()).isEqualTo("John Smith"); assertThat(employee.getName()).isEqualTo("John Smith");

View File

@ -112,7 +112,7 @@ public class AnnotationConfigTransactionalTestNGSpringContextTests
@Test @Test
@Transactional(propagation = Propagation.NOT_SUPPORTED) @Transactional(propagation = Propagation.NOT_SUPPORTED)
void autowiringFromConfigClass() { public void autowiringFromConfigClass() {
assertThat(employee).as("The employee should have been autowired.").isNotNull(); assertThat(employee).as("The employee should have been autowired.").isNotNull();
assertThat(employee.getName()).isEqualTo("John Smith"); assertThat(employee.getName()).isEqualTo("John Smith");
@ -136,7 +136,7 @@ public class AnnotationConfigTransactionalTestNGSpringContextTests
} }
@Test @Test
void modifyTestDataWithinTransaction() { public void modifyTestDataWithinTransaction() {
assertThatTransaction().isActive(); assertThatTransaction().isActive();
assertAddPerson(JANE); assertAddPerson(JANE);
assertAddPerson(SUE); assertAddPerson(SUE);

View File

@ -151,7 +151,7 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans
@Test @Test
@Transactional(propagation = Propagation.NOT_SUPPORTED) @Transactional(propagation = Propagation.NOT_SUPPORTED)
void verifyBeanNameSet() { public void verifyBeanNameSet() {
assertThatTransaction().isNotActive(); assertThatTransaction().isNotActive();
assertThat(this.beanName) 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.") .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 @Test
@Transactional(propagation = Propagation.NOT_SUPPORTED) @Transactional(propagation = Propagation.NOT_SUPPORTED)
void verifyApplicationContextSet() { public void verifyApplicationContextSet() {
assertThatTransaction().isNotActive(); assertThatTransaction().isNotActive();
assertThat(super.applicationContext) assertThat(super.applicationContext)
.as("The application context should have been set due to ApplicationContextAware semantics.") .as("The application context should have been set due to ApplicationContextAware semantics.")
@ -171,7 +171,7 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans
@Test @Test
@Transactional(propagation = Propagation.NOT_SUPPORTED) @Transactional(propagation = Propagation.NOT_SUPPORTED)
void verifyBeanInitialized() { public void verifyBeanInitialized() {
assertThatTransaction().isNotActive(); assertThatTransaction().isNotActive();
assertThat(beanInitialized) assertThat(beanInitialized)
.as("This test instance should have been initialized due to InitializingBean semantics.") .as("This test instance should have been initialized due to InitializingBean semantics.")
@ -180,7 +180,7 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans
@Test @Test
@Transactional(propagation = Propagation.NOT_SUPPORTED) @Transactional(propagation = Propagation.NOT_SUPPORTED)
void verifyAnnotationAutowiredFields() { public void verifyAnnotationAutowiredFields() {
assertThatTransaction().isNotActive(); assertThatTransaction().isNotActive();
assertThat(nonrequiredLong).as("The nonrequiredLong field should NOT have been autowired.").isNull(); assertThat(nonrequiredLong).as("The nonrequiredLong field should NOT have been autowired.").isNull();
assertThat(pet).as("The pet field should have been autowired.").isNotNull(); assertThat(pet).as("The pet field should have been autowired.").isNotNull();
@ -189,7 +189,7 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans
@Test @Test
@Transactional(propagation = Propagation.NOT_SUPPORTED) @Transactional(propagation = Propagation.NOT_SUPPORTED)
void verifyAnnotationAutowiredMethods() { public void verifyAnnotationAutowiredMethods() {
assertThatTransaction().isNotActive(); assertThatTransaction().isNotActive();
assertThat(employee).as("The setEmployee() method should have been autowired.").isNotNull(); assertThat(employee).as("The setEmployee() method should have been autowired.").isNotNull();
assertThat(employee.getName()).as("employee's name.").isEqualTo("John Smith"); assertThat(employee.getName()).as("employee's name.").isEqualTo("John Smith");
@ -197,20 +197,20 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans
@Test @Test
@Transactional(propagation = Propagation.NOT_SUPPORTED) @Transactional(propagation = Propagation.NOT_SUPPORTED)
void verifyResourceAnnotationInjectedFields() { public void verifyResourceAnnotationInjectedFields() {
assertThatTransaction().isNotActive(); assertThatTransaction().isNotActive();
assertThat(foo).as("The foo field should have been injected via @Resource.").isEqualTo("Foo"); assertThat(foo).as("The foo field should have been injected via @Resource.").isEqualTo("Foo");
} }
@Test @Test
@Transactional(propagation = Propagation.NOT_SUPPORTED) @Transactional(propagation = Propagation.NOT_SUPPORTED)
void verifyResourceAnnotationInjectedMethods() { public void verifyResourceAnnotationInjectedMethods() {
assertThatTransaction().isNotActive(); assertThatTransaction().isNotActive();
assertThat(bar).as("The setBar() method should have been injected via @Resource.").isEqualTo("Bar"); assertThat(bar).as("The setBar() method should have been injected via @Resource.").isEqualTo("Bar");
} }
@Test @Test
void modifyTestDataWithinTransaction() { public void modifyTestDataWithinTransaction() {
assertThatTransaction().isActive(); assertThatTransaction().isActive();
assertAddPerson(JANE); assertAddPerson(JANE);
assertAddPerson(SUE); assertAddPerson(SUE);

View File

@ -72,12 +72,12 @@ class TestNGApplicationEventsIntegrationTests extends AbstractTestNGSpringContex
} }
@Test @Test
void test1() { public void test1() {
assertTestExpectations("test1"); assertTestExpectations("test1");
} }
@Test @Test
void test2() { public void test2() {
assertTestExpectations("test2"); assertTestExpectations("test2");
} }

View File

@ -57,7 +57,7 @@ public class ServletTestExecutionListenerTestNGIntegrationTests extends Abstract
* @see #ensureMocksAreReinjectedBetweenTests_2 * @see #ensureMocksAreReinjectedBetweenTests_2
*/ */
@Test @Test
void ensureMocksAreReinjectedBetweenTests_1() { public void ensureMocksAreReinjectedBetweenTests_1() {
assertInjectedServletRequestEqualsRequestInRequestContextHolder(); assertInjectedServletRequestEqualsRequestInRequestContextHolder();
} }
@ -67,7 +67,7 @@ public class ServletTestExecutionListenerTestNGIntegrationTests extends Abstract
* @see #ensureMocksAreReinjectedBetweenTests_1 * @see #ensureMocksAreReinjectedBetweenTests_1
*/ */
@Test @Test
void ensureMocksAreReinjectedBetweenTests_2() { public void ensureMocksAreReinjectedBetweenTests_2() {
assertInjectedServletRequestEqualsRequestInRequestContextHolder(); assertInjectedServletRequestEqualsRequestInRequestContextHolder();
} }

View File

@ -89,7 +89,7 @@ public class TestNGSpringContextWebTests extends AbstractTestNGSpringContextTest
} }
@Test @Test
void basicWacFeatures() throws Exception { public void basicWacFeatures() throws Exception {
assertThat(wac.getServletContext()).as("ServletContext should be set in the WAC.").isNotNull(); assertThat(wac.getServletContext()).as("ServletContext should be set in the WAC.").isNotNull();
assertThat(servletContext).as("ServletContext should have been set via ServletContextAware.").isNotNull(); assertThat(servletContext).as("ServletContext should have been set via ServletContextAware.").isNotNull();
@ -114,7 +114,7 @@ public class TestNGSpringContextWebTests extends AbstractTestNGSpringContextTest
} }
@Test @Test
void fooEnigmaAutowired() { public void fooEnigmaAutowired() {
assertThat(foo).isEqualTo("enigma"); assertThat(foo).isEqualTo("enigma");
} }