Skip to content

Commit 80ff207

Browse files
committed
Migrate to JUnit 5
1 parent cf0a730 commit 80ff207

File tree

11 files changed

+187
-170
lines changed

11 files changed

+187
-170
lines changed

pom.xml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,22 @@
5555
<project.build.outputTimestamp>2022-11-12T18:16:59Z</project.build.outputTimestamp>
5656
</properties>
5757

58+
<dependencyManagement>
59+
<dependencies>
60+
<dependency>
61+
<groupId>org.junit</groupId>
62+
<artifactId>junit-bom</artifactId>
63+
<version>5.9.3</version>
64+
<type>pom</type>
65+
<scope>import</scope>
66+
</dependency>
67+
</dependencies>
68+
</dependencyManagement>
69+
5870
<dependencies>
5971
<dependency>
60-
<groupId>junit</groupId>
61-
<artifactId>junit</artifactId>
62-
<version>4.13.2</version>
72+
<groupId>org.junit.jupiter</groupId>
73+
<artifactId>junit-jupiter</artifactId>
6374
<scope>test</scope>
6475
</dependency>
6576
</dependencies>

src/test/java/org/codehaus/plexus/classworlds/ClassWorldTest.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
* See the License for the specific language governing permissions and
1616
* limitations under the License.
1717
*/
18-
import static org.junit.Assert.assertEquals;
19-
import static org.junit.Assert.assertNotNull;
20-
import static org.junit.Assert.assertSame;
21-
import static org.junit.Assert.assertTrue;
22-
import static org.junit.Assert.fail;
18+
import static org.junit.jupiter.api.Assertions.assertEquals;
19+
import static org.junit.jupiter.api.Assertions.assertNotNull;
20+
import static org.junit.jupiter.api.Assertions.assertSame;
21+
import static org.junit.jupiter.api.Assertions.assertTrue;
22+
import static org.junit.jupiter.api.Assertions.fail;
2323

2424
import java.net.URL;
2525
import java.net.URLClassLoader;
@@ -28,35 +28,35 @@
2828
import org.codehaus.plexus.classworlds.realm.ClassRealm;
2929
import org.codehaus.plexus.classworlds.realm.DuplicateRealmException;
3030
import org.codehaus.plexus.classworlds.realm.NoSuchRealmException;
31-
import org.junit.After;
32-
import org.junit.Before;
33-
import org.junit.Test;
31+
import org.junit.jupiter.api.AfterEach;
32+
import org.junit.jupiter.api.BeforeEach;
33+
import org.junit.jupiter.api.Test;
3434

3535
public class ClassWorldTest
3636
extends AbstractClassWorldsTestCase
3737
{
3838
private ClassWorld world;
3939

40-
@Before
40+
@BeforeEach
4141
public void setUp()
4242
{
4343
this.world = new ClassWorld();
4444
}
4545

46-
@After
46+
@AfterEach
4747
public void tearDown()
4848
{
4949
this.world = null;
5050
}
5151

5252
@Test
53-
public void testEmpty()
53+
void testEmpty()
5454
{
5555
assertTrue( this.world.getRealms().isEmpty() );
5656
}
5757

5858
@Test
59-
public void testNewRealm()
59+
void testNewRealm()
6060
throws Exception
6161
{
6262
ClassRealm realm = this.world.newRealm( "foo" );
@@ -65,7 +65,7 @@ public void testNewRealm()
6565
}
6666

6767
@Test
68-
public void testGetRealm()
68+
void testGetRealm()
6969
throws Exception
7070
{
7171
ClassRealm realm = this.world.newRealm( "foo" );
@@ -74,7 +74,7 @@ public void testGetRealm()
7474
}
7575

7676
@Test
77-
public void testNewRealm_Duplicate()
77+
void testNewRealm_Duplicate()
7878
{
7979
try
8080
{
@@ -94,7 +94,7 @@ public void testNewRealm_Duplicate()
9494
}
9595

9696
@Test
97-
public void testGetRealm_NoSuch()
97+
void testGetRealm_NoSuch()
9898
{
9999
try
100100
{
@@ -112,7 +112,7 @@ public void testGetRealm_NoSuch()
112112
}
113113

114114
@Test
115-
public void testGetRealms()
115+
void testGetRealms()
116116
throws Exception
117117
{
118118
assertTrue( this.world.getRealms().isEmpty() );
@@ -129,9 +129,9 @@ public void testGetRealms()
129129

130130
assertTrue( this.world.getRealms().contains( bar ) );
131131
}
132-
132+
133133
@Test
134-
public void testPLX334()
134+
void testPLX334()
135135
throws Exception
136136
{
137137
ClassLoader loader = new URLClassLoader( new URL[] { getJarUrl( "component1-1.0.jar" ) } );

src/test/java/org/codehaus/plexus/classworlds/UrlUtilsTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@
1616
* limitations under the License.
1717
*/
1818

19-
import junit.framework.TestCase;
19+
import static org.junit.jupiter.api.Assertions.assertEquals;
20+
21+
import org.junit.jupiter.api.Test;
2022

2123
public class UrlUtilsTest
22-
extends TestCase
2324
{
2425

26+
@Test
2527
public void testNormalizeUrlPath()
2628
{
2729
assertEquals( "org/codehaus/Test.class", UrlUtils.normalizeUrlPath( "org/codehaus/Test.class" ) );

src/test/java/org/codehaus/plexus/classworlds/launcher/ConfigurationParserTest.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package org.codehaus.plexus.classworlds.launcher;
22

3-
import static org.junit.Assert.assertEquals;
4-
import static org.junit.Assert.assertTrue;
5-
import static org.junit.Assert.fail;
3+
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
import static org.junit.jupiter.api.Assertions.assertTrue;
5+
import static org.junit.jupiter.api.Assertions.fail;
66

77
import org.codehaus.plexus.classworlds.AbstractClassWorldsTestCase;
8-
import org.junit.Test;
8+
import org.junit.jupiter.api.Test;
99

1010
public class ConfigurationParserTest
1111
extends AbstractClassWorldsTestCase
@@ -14,7 +14,7 @@ public class ConfigurationParserTest
1414
ConfigurationParser configurator = new ConfigurationParser( null, System.getProperties() );
1515

1616
@Test
17-
public void testFilter_Unterminated()
17+
void testFilter_Unterminated()
1818
{
1919
try
2020
{
@@ -29,7 +29,7 @@ public void testFilter_Unterminated()
2929
}
3030

3131
@Test
32-
public void testFilter_Solitary()
32+
void testFilter_Solitary()
3333
throws Exception
3434
{
3535
System.setProperty( "classworlds.test.prop", "test prop value" );
@@ -40,7 +40,7 @@ public void testFilter_Solitary()
4040
}
4141

4242
@Test
43-
public void testFilter_AtStart()
43+
void testFilter_AtStart()
4444
throws Exception
4545
{
4646
System.setProperty( "classworlds.test.prop", "test prop value" );
@@ -51,7 +51,7 @@ public void testFilter_AtStart()
5151
}
5252

5353
@Test
54-
public void testFilter_AtEnd()
54+
void testFilter_AtEnd()
5555
throws Exception
5656
{
5757
System.setProperty( "classworlds.test.prop", "test prop value" );
@@ -62,7 +62,7 @@ public void testFilter_AtEnd()
6262
}
6363

6464
@Test
65-
public void testFilter_Multiple()
65+
void testFilter_Multiple()
6666
throws Exception
6767
{
6868
System.setProperty( "classworlds.test.prop.one", "test prop value one" );
@@ -76,7 +76,7 @@ public void testFilter_Multiple()
7676
}
7777

7878
@Test
79-
public void testFilter_NonExistent()
79+
void testFilter_NonExistent()
8080
{
8181
try
8282
{
@@ -91,7 +91,7 @@ public void testFilter_NonExistent()
9191
}
9292

9393
@Test
94-
public void testFilter_InMiddle()
94+
void testFilter_InMiddle()
9595
throws Exception
9696
{
9797
System.setProperty( "classworlds.test.prop", "test prop value" );

0 commit comments

Comments
 (0)