Skip to content

Migrate to JUnit 5 #86

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,22 @@
<project.build.outputTimestamp>2022-11-12T18:16:59Z</project.build.outputTimestamp>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.9.3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
38 changes: 19 additions & 19 deletions src/test/java/org/codehaus/plexus/classworlds/ClassWorldTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;

import java.net.URL;
import java.net.URLClassLoader;
Expand All @@ -28,35 +28,35 @@
import org.codehaus.plexus.classworlds.realm.ClassRealm;
import org.codehaus.plexus.classworlds.realm.DuplicateRealmException;
import org.codehaus.plexus.classworlds.realm.NoSuchRealmException;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

public class ClassWorldTest
class ClassWorldTest
extends AbstractClassWorldsTestCase
{
private ClassWorld world;

@Before
@BeforeEach
public void setUp()
{
this.world = new ClassWorld();
}

@After
@AfterEach
public void tearDown()
{
this.world = null;
}

@Test
public void testEmpty()
void testEmpty()
{
assertTrue( this.world.getRealms().isEmpty() );
}

@Test
public void testNewRealm()
void testNewRealm()
throws Exception
{
ClassRealm realm = this.world.newRealm( "foo" );
Expand All @@ -65,7 +65,7 @@ public void testNewRealm()
}

@Test
public void testGetRealm()
void testGetRealm()
throws Exception
{
ClassRealm realm = this.world.newRealm( "foo" );
Expand All @@ -74,7 +74,7 @@ public void testGetRealm()
}

@Test
public void testNewRealm_Duplicate()
void testNewRealm_Duplicate()
{
try
{
Expand All @@ -94,7 +94,7 @@ public void testNewRealm_Duplicate()
}

@Test
public void testGetRealm_NoSuch()
void testGetRealm_NoSuch()
{
try
{
Expand All @@ -112,7 +112,7 @@ public void testGetRealm_NoSuch()
}

@Test
public void testGetRealms()
void testGetRealms()
throws Exception
{
assertTrue( this.world.getRealms().isEmpty() );
Expand All @@ -129,9 +129,9 @@ public void testGetRealms()

assertTrue( this.world.getRealms().contains( bar ) );
}

@Test
public void testPLX334()
void testPLX334()
throws Exception
{
ClassLoader loader = new URLClassLoader( new URL[] { getJarUrl( "component1-1.0.jar" ) } );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@
* limitations under the License.
*/

import junit.framework.TestCase;
import static org.junit.jupiter.api.Assertions.assertEquals;

public class UrlUtilsTest
extends TestCase
import org.junit.jupiter.api.Test;

class UrlUtilsTest
{

@Test
public void testNormalizeUrlPath()
{
assertEquals( "org/codehaus/Test.class", UrlUtils.normalizeUrlPath( "org/codehaus/Test.class" ) );
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package org.codehaus.plexus.classworlds.launcher;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;

import org.codehaus.plexus.classworlds.AbstractClassWorldsTestCase;
import org.junit.Test;
import org.junit.jupiter.api.Test;

public class ConfigurationParserTest
class ConfigurationParserTest
extends AbstractClassWorldsTestCase
{

ConfigurationParser configurator = new ConfigurationParser( null, System.getProperties() );

@Test
public void testFilter_Unterminated()
void testFilter_Unterminated()
{
try
{
Expand All @@ -29,7 +29,7 @@ public void testFilter_Unterminated()
}

@Test
public void testFilter_Solitary()
void testFilter_Solitary()
throws Exception
{
System.setProperty( "classworlds.test.prop", "test prop value" );
Expand All @@ -40,7 +40,7 @@ public void testFilter_Solitary()
}

@Test
public void testFilter_AtStart()
void testFilter_AtStart()
throws Exception
{
System.setProperty( "classworlds.test.prop", "test prop value" );
Expand All @@ -51,7 +51,7 @@ public void testFilter_AtStart()
}

@Test
public void testFilter_AtEnd()
void testFilter_AtEnd()
throws Exception
{
System.setProperty( "classworlds.test.prop", "test prop value" );
Expand All @@ -62,7 +62,7 @@ public void testFilter_AtEnd()
}

@Test
public void testFilter_Multiple()
void testFilter_Multiple()
throws Exception
{
System.setProperty( "classworlds.test.prop.one", "test prop value one" );
Expand All @@ -76,7 +76,7 @@ public void testFilter_Multiple()
}

@Test
public void testFilter_NonExistent()
void testFilter_NonExistent()
{
try
{
Expand All @@ -91,7 +91,7 @@ public void testFilter_NonExistent()
}

@Test
public void testFilter_InMiddle()
void testFilter_InMiddle()
throws Exception
{
System.setProperty( "classworlds.test.prop", "test prop value" );
Expand Down
Loading