Skip to content

Commit bfdc831

Browse files
authored
chore: delete junit3 reference (#11308) (#11771)
* chore: delete junit3 reference - updated test to junit5 - delete dead code * fix(ci): replace junit 3 dep by junit 5 dep * fix(ci): replace junit 3 dep by junit 4 dep * Remove reference for junit.framework.TestCas from test plugin --------- (cherry picked from commit 9d675bb) Signed-off-by: Sandra Parsick <sandra@parsick.dev>
1 parent b721377 commit bfdc831

File tree

108 files changed

+166
-1383
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+166
-1383
lines changed

compat/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/AbstractConflictResolverTest.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,6 @@ public AbstractConflictResolverTest(String roleHint) throws Exception {
6969
this.roleHint = roleHint;
7070
}
7171

72-
// TestCase methods -------------------------------------------------------
73-
74-
/*
75-
* @see junit.framework.TestCase#setUp()
76-
*/
7772
@BeforeEach
7873
public void setUp() throws Exception {
7974
conflictResolver = (ConflictResolver) container.lookup(ConflictResolver.ROLE, roleHint);

compat/maven-embedder/src/examples/simple-project/pom.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ under the License.
2626
<name>simple-project</name>
2727
<url>http://maven.apache.org</url>
2828
<dependencies>
29-
<dependency>
30-
<groupId>junit</groupId>
31-
<artifactId>junit</artifactId>
32-
<version>4.13.1</version>
33-
<scope>test</scope>
34-
</dependency>
29+
<dependency>
30+
<groupId>org.junit.jupiter</groupId>
31+
<artifactId>junit-jupiter-api</artifactId>
32+
<version>5.14.0</version>
33+
<scope>test</scope>
34+
</dependency>
3535
</dependencies>
3636
<properties>
3737
<environment>development</environment>

compat/maven-embedder/src/examples/simple-project/src/test/java/org/apache/maven/embedder/AppTest.java

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -19,39 +19,19 @@
1919

2020
package org.apache.maven.embedder;
2121

22-
import junit.framework.Test;
23-
import junit.framework.TestCase;
24-
import junit.framework.TestSuite;
25-
22+
import org.junit.jupiter.api.Test;
23+
import static org.junit.jupiter.api.Assertions.assertTrue;
2624
/**
2725
* Unit test for simple App.
2826
*/
29-
public class AppTest
30-
extends TestCase
31-
{
32-
/**
33-
* Create the test case
34-
*
35-
* @param testName name of the test case
36-
*/
37-
public AppTest( String testName )
38-
{
39-
super( testName );
40-
}
27+
public class AppTest {
4128

4229
/**
43-
* @return the suite of tests being tested
30+
* Rigourous Test :-)
4431
*/
45-
public static Test suite()
46-
{
47-
return new TestSuite( AppTest.class );
48-
}
49-
50-
/**
51-
* Rigorous Test :-)
52-
*/
53-
public void testApp()
54-
{
55-
assertTrue( true );
32+
@Test
33+
public void testApp() {
34+
assertTrue(true);
5635
}
5736
}
37+

compat/maven-embedder/src/test/java/org/apache/maven/cli/props/MavenPropertiesTest.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@ public class MavenPropertiesTest {
5959
test=test
6060
""";
6161

62-
/*
63-
* (non-Javadoc)
64-
* @see junit.framework.TestCase#setUp()
65-
*/
6662
@BeforeEach
6763
public void setUp() throws Exception {
6864
properties = new MavenProperties();
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,18 @@
11
package org.apache.maven.lifecycle.test;
22

3-
import junit.framework.Test;
4-
import junit.framework.TestCase;
5-
import junit.framework.TestSuite;
6-
3+
import org.junit.jupiter.api.Test;
4+
import static org.junit.jupiter.api.Assertions.assertTrue;
75
/**
86
* Unit test for simple App.
97
*/
10-
public class AppTest
11-
extends TestCase
12-
{
13-
/**
14-
* Create the test case
15-
*
16-
* @param testName name of the test case
17-
*/
18-
public AppTest( String testName )
19-
{
20-
super( testName );
21-
}
8+
public class AppTest {
229

2310
/**
24-
* @return the suite of tests being tested
11+
* Rigourous Test :-)
2512
*/
26-
public static Test suite()
27-
{
28-
return new TestSuite( AppTest.class );
29-
}
30-
31-
/**
32-
* Rigorous Test :-)
33-
*/
34-
public void testApp()
35-
{
36-
assertTrue( true );
13+
@Test
14+
public void testApp() {
15+
assertTrue(true);
3716
}
3817
}
18+

impl/maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-utils/1.0.4/plexus-utils-1.0.4.pom

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@
212212
<dependency>
213213
<groupId>junit</groupId>
214214
<artifactId>junit</artifactId>
215-
<version>3.8.1</version>
215+
<version>4.12</version>
216216
<scope>test</scope>
217217
</dependency>
218218
</dependencies>

its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2690MojoLoadingErrorsTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public void testNoClassDefFromMojoLoad() throws IOException, VerificationExcepti
6060
int msg = indexOf(lines, "(?i).*required class is missing.*");
6161
assertTrue(msg >= 0, "User-friendly message was not found in output.");
6262

63-
int cls = lines.get(msg).toString().replace('/', '.').indexOf("junit.framework.TestCase");
63+
int cls = lines.get(msg).toString().replace('/', '.').indexOf("org.apache.commons.lang3.StringUtils");
6464
assertTrue(cls >= 0, "Missing class name was not found in output.");
6565
}
6666

@@ -80,7 +80,7 @@ public void testNoClassDefFromMojoConfiguration() throws IOException, Verificati
8080
int msg = indexOf(lines, "(?i).*required class (i|wa)s missing( during (mojo )?configuration)?.*");
8181
assertTrue(msg >= 0, "User-friendly message was not found in output.");
8282

83-
int cls = lines.get(msg).toString().replace('/', '.').indexOf("junit.framework.TestCase");
83+
int cls = lines.get(msg).toString().replace('/', '.').indexOf("org.apache.commons.lang3.StringUtils");
8484
assertTrue(cls >= 0, "Missing class name was not found in output.");
8585
}
8686

its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5640LifecycleParticipantAfterSessionEnd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public void testBuildFailureUTFail() throws Exception {
5656
verifier = newVerifier(projectDir.getAbsolutePath(), "remote");
5757
verifier.addCliArgument("package");
5858
assertThrows(VerificationException.class, verifier::execute, "The build should fail");
59-
verifier.verifyTextInLog("testApp(org.apache.maven.its.mng5640.FailingTest)");
59+
verifier.verifyTextInLog("testApp()");
6060

6161
verifier.verifyFilePresent("target/afterProjectsRead.txt");
6262
// See https://issues.apache.org/jira/browse/MNG-5641

its/core-it-suite/src/test/resources/it0030/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<dependency>
1717
<groupId>junit</groupId>
1818
<artifactId>junit</artifactId>
19-
<version>3.8.1</version>
19+
<version>4.12</version>
2020
</dependency>
2121
<dependency>
2222
<groupId>org.apache.maven.its.it0030</groupId>

its/core-it-suite/src/test/resources/mng-0624/dependencyManagement/child/grandchild1/pom.xml

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)