Skip to content

Commit 6eed2b0

Browse files
committed
Upgrade to "TestNG Engine for the JUnit Platform" version 1.0.5
Thanks to a bug fix in 1.0.5, test methods in TestNG test classes can finally be package private as was always the case with TestNG itself. See junit-team/testng-engine#16
1 parent 7876db0 commit 6eed2b0

16 files changed

+74
-74
lines changed

framework-platform/framework-platform.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ dependencies {
131131
api("org.hsqldb:hsqldb:2.7.2")
132132
api("org.javamoney:moneta:1.4.2")
133133
api("org.jruby:jruby:9.4.5.0")
134-
api("org.junit.support:testng-engine:1.0.4")
134+
api("org.junit.support:testng-engine:1.0.5")
135135
api("org.mozilla:rhino:1.7.14")
136136
api("org.ogce:xpp3:1.1.6")
137137
api("org.python:jython-standalone:2.7.3")

spring-test/src/test/java/org/springframework/test/context/testng/AnnotationConfigTestNGSpringContextTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -39,7 +39,7 @@
3939
* @since 5.1
4040
*/
4141
@ContextConfiguration
42-
public class AnnotationConfigTestNGSpringContextTests extends AbstractTestNGSpringContextTests {
42+
class AnnotationConfigTestNGSpringContextTests extends AbstractTestNGSpringContextTests {
4343

4444
@Autowired
4545
Employee employee;
@@ -48,7 +48,7 @@ public class AnnotationConfigTestNGSpringContextTests extends AbstractTestNGSpri
4848
Pet pet;
4949

5050
@Test
51-
public void autowiringFromConfigClass() {
51+
void autowiringFromConfigClass() {
5252
assertThat(employee).as("The employee should have been autowired.").isNotNull();
5353
assertThat(employee.getName()).isEqualTo("John Smith");
5454

spring-test/src/test/java/org/springframework/test/context/testng/AnnotationConfigTransactionalTestNGSpringContextTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -54,7 +54,7 @@
5454
* @since 3.1
5555
*/
5656
@ContextConfiguration
57-
public class AnnotationConfigTransactionalTestNGSpringContextTests
57+
class AnnotationConfigTransactionalTestNGSpringContextTests
5858
extends AbstractTransactionalTestNGSpringContextTests {
5959

6060
private static final String JANE = "jane";
@@ -112,7 +112,7 @@ void afterClass() {
112112

113113
@Test
114114
@Transactional(propagation = Propagation.NOT_SUPPORTED)
115-
public void autowiringFromConfigClass() {
115+
void autowiringFromConfigClass() {
116116
assertThat(employee).as("The employee should have been autowired.").isNotNull();
117117
assertThat(employee.getName()).isEqualTo("John Smith");
118118

@@ -136,7 +136,7 @@ void setUp() throws Exception {
136136
}
137137

138138
@Test
139-
public void modifyTestDataWithinTransaction() {
139+
void modifyTestDataWithinTransaction() {
140140
assertThatTransaction().isActive();
141141
assertAddPerson(JANE);
142142
assertAddPerson(SUE);

spring-test/src/test/java/org/springframework/test/context/testng/ConcreteTransactionalTestNGSpringContextTests.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -46,7 +46,7 @@
4646
* @since 2.5
4747
*/
4848
@ContextConfiguration
49-
public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTransactionalTestNGSpringContextTests
49+
class ConcreteTransactionalTestNGSpringContextTests extends AbstractTransactionalTestNGSpringContextTests
5050
implements BeanNameAware, InitializingBean {
5151

5252
private static final String JANE = "jane";
@@ -150,7 +150,7 @@ void afterTransaction() {
150150

151151
@Test
152152
@Transactional(propagation = Propagation.NOT_SUPPORTED)
153-
public void verifyBeanNameSet() {
153+
void verifyBeanNameSet() {
154154
assertThatTransaction().isNotActive();
155155
assertThat(this.beanName)
156156
.as("The bean name of this test instance should have been set to the fully qualified class name due to BeanNameAware semantics.")
@@ -159,7 +159,7 @@ public void verifyBeanNameSet() {
159159

160160
@Test
161161
@Transactional(propagation = Propagation.NOT_SUPPORTED)
162-
public void verifyApplicationContextSet() {
162+
void verifyApplicationContextSet() {
163163
assertThatTransaction().isNotActive();
164164
assertThat(super.applicationContext)
165165
.as("The application context should have been set due to ApplicationContextAware semantics.")
@@ -170,7 +170,7 @@ public void verifyApplicationContextSet() {
170170

171171
@Test
172172
@Transactional(propagation = Propagation.NOT_SUPPORTED)
173-
public void verifyBeanInitialized() {
173+
void verifyBeanInitialized() {
174174
assertThatTransaction().isNotActive();
175175
assertThat(beanInitialized)
176176
.as("This test instance should have been initialized due to InitializingBean semantics.")
@@ -179,7 +179,7 @@ public void verifyBeanInitialized() {
179179

180180
@Test
181181
@Transactional(propagation = Propagation.NOT_SUPPORTED)
182-
public void verifyAnnotationAutowiredFields() {
182+
void verifyAnnotationAutowiredFields() {
183183
assertThatTransaction().isNotActive();
184184
assertThat(nonrequiredLong).as("The nonrequiredLong field should NOT have been autowired.").isNull();
185185
assertThat(pet).as("The pet field should have been autowired.").isNotNull();
@@ -188,28 +188,28 @@ public void verifyAnnotationAutowiredFields() {
188188

189189
@Test
190190
@Transactional(propagation = Propagation.NOT_SUPPORTED)
191-
public void verifyAnnotationAutowiredMethods() {
191+
void verifyAnnotationAutowiredMethods() {
192192
assertThatTransaction().isNotActive();
193193
assertThat(employee).as("The setEmployee() method should have been autowired.").isNotNull();
194194
assertThat(employee.getName()).as("employee's name.").isEqualTo("John Smith");
195195
}
196196

197197
@Test
198198
@Transactional(propagation = Propagation.NOT_SUPPORTED)
199-
public void verifyResourceAnnotationInjectedFields() {
199+
void verifyResourceAnnotationInjectedFields() {
200200
assertThatTransaction().isNotActive();
201201
assertThat(foo).as("The foo field should have been injected via @Resource.").isEqualTo("Foo");
202202
}
203203

204204
@Test
205205
@Transactional(propagation = Propagation.NOT_SUPPORTED)
206-
public void verifyResourceAnnotationInjectedMethods() {
206+
void verifyResourceAnnotationInjectedMethods() {
207207
assertThatTransaction().isNotActive();
208208
assertThat(bar).as("The setBar() method should have been injected via @Resource.").isEqualTo("Bar");
209209
}
210210

211211
@Test
212-
public void modifyTestDataWithinTransaction() {
212+
void modifyTestDataWithinTransaction() {
213213
assertThatTransaction().isActive();
214214
assertAddPerson(JANE);
215215
assertAddPerson(SUE);

spring-test/src/test/java/org/springframework/test/context/testng/DirtiesContextTransactionalTestNGSpringContextTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -47,7 +47,7 @@
4747
* @since 2.5
4848
*/
4949
@ContextConfiguration
50-
public class DirtiesContextTransactionalTestNGSpringContextTests extends AbstractTransactionalTestNGSpringContextTests {
50+
class DirtiesContextTransactionalTestNGSpringContextTests extends AbstractTransactionalTestNGSpringContextTests {
5151

5252
private ApplicationContext dirtiedApplicationContext;
5353

@@ -64,13 +64,13 @@ private void performCommonAssertions() {
6464

6565
@Test
6666
@DirtiesContext
67-
public void dirtyContext() {
67+
void dirtyContext() {
6868
performCommonAssertions();
6969
this.dirtiedApplicationContext = super.applicationContext;
7070
}
7171

7272
@Test(dependsOnMethods = { "dirtyContext" })
73-
public void verifyContextWasDirtied() {
73+
void verifyContextWasDirtied() {
7474
performCommonAssertions();
7575
assertThat(super.applicationContext)
7676
.as("The application context should have been 'dirtied'.")
@@ -79,7 +79,7 @@ public void verifyContextWasDirtied() {
7979
}
8080

8181
@Test(dependsOnMethods = { "verifyContextWasDirtied" })
82-
public void verifyContextWasNotDirtied() {
82+
void verifyContextWasNotDirtied() {
8383
assertThat(this.applicationContext)
8484
.as("The application context should NOT have been 'dirtied'.")
8585
.isSameAs(this.dirtiedApplicationContext);

spring-test/src/test/java/org/springframework/test/context/testng/TimedTransactionalTestNGSpringContextTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -32,16 +32,16 @@
3232
* @since 3.0
3333
*/
3434
@ContextConfiguration
35-
public class TimedTransactionalTestNGSpringContextTests extends AbstractTransactionalTestNGSpringContextTests {
35+
class TimedTransactionalTestNGSpringContextTests extends AbstractTransactionalTestNGSpringContextTests {
3636

3737
@Test
38-
public void testWithoutTimeout() {
38+
void testWithoutTimeout() {
3939
assertThatTransaction().isActive();
4040
}
4141

4242
// TODO Enable TestNG test with timeout once we have a solution.
4343
@Test(timeOut = 10000, enabled = false)
44-
public void testWithTimeout() {
44+
void testWithTimeout() {
4545
assertThatTransaction().isActive();
4646
}
4747

spring-test/src/test/java/org/springframework/test/context/testng/event/TestNGApplicationEventsAsyncIntegrationTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -49,7 +49,7 @@ class TestNGApplicationEventsAsyncIntegrationTests extends AbstractTestNGSpringC
4949

5050

5151
@Test
52-
public void asyncPublication() throws InterruptedException {
52+
void asyncPublication() throws InterruptedException {
5353
Thread t = new Thread(() -> context.publishEvent(new CustomEvent("asyncPublication")));
5454
t.start();
5555
t.join();
@@ -61,7 +61,7 @@ public void asyncPublication() throws InterruptedException {
6161
}
6262

6363
@Test
64-
public void asyncConsumption() {
64+
void asyncConsumption() {
6565
context.publishEvent(new CustomEvent("asyncConsumption"));
6666

6767
Awaitility.await().atMost(Durations.ONE_SECOND)

spring-test/src/test/java/org/springframework/test/context/testng/event/TestNGApplicationEventsIntegrationTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -72,12 +72,12 @@ void beforeEach() {
7272
}
7373

7474
@Test
75-
public void test1() {
75+
void test1() {
7676
assertTestExpectations("test1");
7777
}
7878

7979
@Test
80-
public void test2() {
80+
void test2() {
8181
assertTestExpectations("test2");
8282
}
8383

spring-test/src/test/java/org/springframework/test/context/testng/transaction/ejb/AbstractEjbTxDaoTestNGTests.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -38,7 +38,7 @@
3838
* @since 4.0.1
3939
*/
4040
@DirtiesContext(classMode = ClassMode.AFTER_CLASS)
41-
public abstract class AbstractEjbTxDaoTestNGTests extends AbstractTransactionalTestNGSpringContextTests {
41+
abstract class AbstractEjbTxDaoTestNGTests extends AbstractTransactionalTestNGSpringContextTests {
4242

4343
protected static final String TEST_NAME = "test-name";
4444

@@ -50,13 +50,13 @@ public abstract class AbstractEjbTxDaoTestNGTests extends AbstractTransactionalT
5050

5151

5252
@Test
53-
public void test1InitialState() {
53+
void test1InitialState() {
5454
int count = dao.getCount(TEST_NAME);
5555
assertThat(count).as("New TestEntity should have count=0.").isEqualTo(0);
5656
}
5757

5858
@Test(dependsOnMethods = "test1InitialState")
59-
public void test2IncrementCount1() {
59+
void test2IncrementCount1() {
6060
int count = dao.incrementCount(TEST_NAME);
6161
assertThat(count).as("Expected count=1 after first increment.").isEqualTo(1);
6262
}
@@ -67,7 +67,7 @@ public void test2IncrementCount1() {
6767
* expected that the previous increment has been persisted in the database.
6868
*/
6969
@Test(dependsOnMethods = "test2IncrementCount1")
70-
public void test3IncrementCount2() {
70+
void test3IncrementCount2() {
7171
int count = dao.getCount(TEST_NAME);
7272
assertThat(count).as("Expected count=1 after test2IncrementCount1().").isEqualTo(1);
7373

@@ -76,7 +76,7 @@ public void test3IncrementCount2() {
7676
}
7777

7878
@AfterMethod(alwaysRun = true)
79-
public void synchronizePersistenceContext() {
79+
void synchronizePersistenceContext() {
8080
em.flush();
8181
}
8282

spring-test/src/test/java/org/springframework/test/context/testng/transaction/ejb/CommitForRequiredEjbTxDaoTestNGTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@
3535
@Test(suiteName = "Commit for REQUIRED")
3636
@ContextConfiguration("/org/springframework/test/context/transaction/ejb/required-tx-config.xml")
3737
@Commit
38-
public class CommitForRequiredEjbTxDaoTestNGTests extends AbstractEjbTxDaoTestNGTests {
38+
class CommitForRequiredEjbTxDaoTestNGTests extends AbstractEjbTxDaoTestNGTests {
3939

4040
/* test methods in superclass */
4141

spring-test/src/test/java/org/springframework/test/context/testng/transaction/ejb/CommitForRequiresNewEjbTxDaoTestNGTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@
3535
@Test(suiteName = "Commit for REQUIRES_NEW")
3636
@ContextConfiguration("/org/springframework/test/context/transaction/ejb/requires-new-tx-config.xml")
3737
@Commit
38-
public class CommitForRequiresNewEjbTxDaoTestNGTests extends AbstractEjbTxDaoTestNGTests {
38+
class CommitForRequiresNewEjbTxDaoTestNGTests extends AbstractEjbTxDaoTestNGTests {
3939

4040
/* test methods in superclass */
4141

spring-test/src/test/java/org/springframework/test/context/testng/transaction/ejb/RollbackForRequiredEjbTxDaoTestNGTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -36,7 +36,7 @@
3636
*/
3737
@Test(suiteName = "Rollback for REQUIRED")
3838
@Rollback
39-
public class RollbackForRequiredEjbTxDaoTestNGTests extends CommitForRequiredEjbTxDaoTestNGTests {
39+
class RollbackForRequiredEjbTxDaoTestNGTests extends CommitForRequiredEjbTxDaoTestNGTests {
4040

4141
/**
4242
* Overrides parent implementation in order to change expectations to align with
@@ -46,7 +46,7 @@ public class RollbackForRequiredEjbTxDaoTestNGTests extends CommitForRequiredEjb
4646
*/
4747
@Test(dependsOnMethods = "test2IncrementCount1")
4848
@Override
49-
public void test3IncrementCount2() {
49+
void test3IncrementCount2() {
5050
int count = dao.getCount(TEST_NAME);
5151
// Expecting count=0 after test2IncrementCount1() since REQUIRED transactions
5252
// participate in the existing transaction (if present), which in this case is the

spring-test/src/test/java/org/springframework/test/context/testng/transaction/ejb/RollbackForRequiresNewEjbTxDaoTestNGTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -38,7 +38,7 @@
3838
*/
3939
@Test(suiteName = "Rollback for REQUIRES_NEW")
4040
@Rollback
41-
public class RollbackForRequiresNewEjbTxDaoTestNGTests extends CommitForRequiresNewEjbTxDaoTestNGTests {
41+
class RollbackForRequiresNewEjbTxDaoTestNGTests extends CommitForRequiresNewEjbTxDaoTestNGTests {
4242

4343
/* test methods in superclass */
4444

0 commit comments

Comments
 (0)