Skip to content

Commit

Permalink
Make TestNG test methods public due to bug in TestNG TestEngine
Browse files Browse the repository at this point in the history
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.

junit-team/testng-engine#16

See gh-27407
  • Loading branch information
sbrannen committed Sep 21, 2021
1 parent 40c51ef commit 2849605
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ void afterClass() {

@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");

Expand All @@ -136,7 +136,7 @@ void setUp() throws Exception {
}

@Test
void modifyTestDataWithinTransaction() {
public void modifyTestDataWithinTransaction() {
assertThatTransaction().isActive();
assertAddPerson(JANE);
assertAddPerson(SUE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ void afterTransaction() {

@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.")
Expand All @@ -160,7 +160,7 @@ void verifyBeanNameSet() {

@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.")
Expand All @@ -171,7 +171,7 @@ void verifyApplicationContextSet() {

@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.")
Expand All @@ -180,7 +180,7 @@ void verifyBeanInitialized() {

@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();
Expand All @@ -189,28 +189,28 @@ void verifyAnnotationAutowiredFields() {

@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");
}

@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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ void beforeEach() {
}

@Test
void test1() {
public void test1() {
assertTestExpectations("test1");
}

@Test
void test2() {
public void test2() {
assertTestExpectations("test2");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static class Config {
* @see #ensureMocksAreReinjectedBetweenTests_2
*/
@Test
void ensureMocksAreReinjectedBetweenTests_1() {
public void ensureMocksAreReinjectedBetweenTests_1() {
assertInjectedServletRequestEqualsRequestInRequestContextHolder();
}

Expand All @@ -67,7 +67,7 @@ void ensureMocksAreReinjectedBetweenTests_1() {
* @see #ensureMocksAreReinjectedBetweenTests_1
*/
@Test
void ensureMocksAreReinjectedBetweenTests_2() {
public void ensureMocksAreReinjectedBetweenTests_2() {
assertInjectedServletRequestEqualsRequestInRequestContextHolder();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void setServletContext(ServletContext servletContext) {
}

@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();
Expand All @@ -114,7 +114,7 @@ void basicWacFeatures() throws Exception {
}

@Test
void fooEnigmaAutowired() {
public void fooEnigmaAutowired() {
assertThat(foo).isEqualTo("enigma");
}

Expand Down

0 comments on commit 2849605

Please sign in to comment.