Issue #23507 glassfish-api uses junit5 instead of junit4
diff --git a/nucleus/common/glassfish-api/pom.xml b/nucleus/common/glassfish-api/pom.xml
index 1abe3db..ee4092f 100644
--- a/nucleus/common/glassfish-api/pom.xml
+++ b/nucleus/common/glassfish-api/pom.xml
@@ -90,6 +90,10 @@
</dependency>
<dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
</dependency>
diff --git a/nucleus/common/glassfish-api/src/test/java/org/glassfish/api/admin/WrappedAdminCommandTest.java b/nucleus/common/glassfish-api/src/test/java/org/glassfish/api/admin/WrappedAdminCommandTest.java
index d44cbc2..8519d6c 100644
--- a/nucleus/common/glassfish-api/src/test/java/org/glassfish/api/admin/WrappedAdminCommandTest.java
+++ b/nucleus/common/glassfish-api/src/test/java/org/glassfish/api/admin/WrappedAdminCommandTest.java
@@ -16,20 +16,18 @@
package org.glassfish.api.admin;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
import org.glassfish.api.Param;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
/**
- *
* @author Andriy Zhdanov
- *
*/
public class WrappedAdminCommandTest {
- /*
+ /**
* Test getParamValue from wrapped command.
*/
@Test
@@ -42,10 +40,10 @@
// nothing todo
}
};
- assertEquals("set param value", "test", CommandSupport.getParamValue(wrappedCommand, "foo"));
+ assertEquals("test", CommandSupport.getParamValue(wrappedCommand, "foo"), "set param value");
// note, after resolver it must be not null
- assertNull("unset param value must be null", CommandSupport.getParamValue(wrappedCommand, "foobar"));
- assertNull("non existent param value must be null", CommandSupport.getParamValue(wrappedCommand, "dummy"));
+ assertNull(CommandSupport.getParamValue(wrappedCommand, "foobar"), "unset param value must be null");
+ assertNull(CommandSupport.getParamValue(wrappedCommand, "dummy"), "non existent param value must be null");
}
private class DummyAdminCommand implements AdminCommand {
diff --git a/nucleus/common/glassfish-api/src/test/java/org/glassfish/api/admin/progress/ProgressStatusImplTest.java b/nucleus/common/glassfish-api/src/test/java/org/glassfish/api/admin/progress/ProgressStatusImplTest.java
index 7882f9b..fbdb7a1 100644
--- a/nucleus/common/glassfish-api/src/test/java/org/glassfish/api/admin/progress/ProgressStatusImplTest.java
+++ b/nucleus/common/glassfish-api/src/test/java/org/glassfish/api/admin/progress/ProgressStatusImplTest.java
@@ -17,8 +17,16 @@
package org.glassfish.api.admin.progress;
import org.glassfish.api.admin.ProgressStatus;
-import org.junit.*;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.lessThan;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
*
@@ -28,10 +36,7 @@
private DummyParent parent;
- public ProgressStatusImplTest() {
- }
-
- @Before
+ @BeforeEach
public void prepareParent() {
parent = new DummyParent();
}
@@ -39,7 +44,7 @@
@Test
public void testGetSetTotalStepCount() {
ProgressStatusImpl psi = new ProgressStatusImpl("first", parent, null);
- assertTrue(psi.getTotalStepCount() < 0);
+ assertThat(psi.getTotalStepCount(), lessThan(0));
psi.setTotalStepCount(10);
assertNotNull(parent.lastEvent);
parent.lastEvent = null;
@@ -91,9 +96,9 @@
assertNull(parent.lastEvent);
assertEquals(0, psi.getRemainingStepCount());
psi = new ProgressStatusImpl("second", parent, null);
- assertTrue(psi.getRemainingStepCount() < 0);
+ assertThat(psi.getRemainingStepCount(), lessThan(0));
psi.progress(1);
- assertTrue(psi.getRemainingStepCount() < 0);
+ assertThat(psi.getRemainingStepCount(), lessThan(0));
psi.setTotalStepCount(10);
assertEquals(9, psi.getRemainingStepCount());
psi.complete();
diff --git a/nucleus/common/glassfish-api/src/test/java/org/glassfish/api/admin/progress/ProgressStatusMirroringImplTest.java b/nucleus/common/glassfish-api/src/test/java/org/glassfish/api/admin/progress/ProgressStatusMirroringImplTest.java
index 40e5d07..9401cfa 100644
--- a/nucleus/common/glassfish-api/src/test/java/org/glassfish/api/admin/progress/ProgressStatusMirroringImplTest.java
+++ b/nucleus/common/glassfish-api/src/test/java/org/glassfish/api/admin/progress/ProgressStatusMirroringImplTest.java
@@ -17,11 +17,13 @@
package org.glassfish.api.admin.progress;
import org.glassfish.api.admin.ProgressStatus;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.Test;
-import static org.junit.Assert.*;
-import org.junit.BeforeClass;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
*
@@ -31,18 +33,7 @@
private DummyParent parent;
- public ProgressStatusMirroringImplTest() {
- }
-
-// @BeforeClass
-// public static void setUpClass() throws Exception {
-// }
-//
-// @AfterClass
-// public static void tearDownClass() throws Exception {
-// }
-
- @Before
+ @BeforeEach
public void setUp() {
parent = new DummyParent();
}
diff --git a/nucleus/common/glassfish-api/src/test/java/org/glassfish/api/tests/ImmutableTest.java b/nucleus/common/glassfish-api/src/test/java/org/glassfish/api/event/EventTypesTest.java
similarity index 73%
rename from nucleus/common/glassfish-api/src/test/java/org/glassfish/api/tests/ImmutableTest.java
rename to nucleus/common/glassfish-api/src/test/java/org/glassfish/api/event/EventTypesTest.java
index a383be2..08d3a32 100755
--- a/nucleus/common/glassfish-api/src/test/java/org/glassfish/api/tests/ImmutableTest.java
+++ b/nucleus/common/glassfish-api/src/test/java/org/glassfish/api/event/EventTypesTest.java
@@ -14,14 +14,14 @@
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
-package org.glassfish.api.tests;
+package org.glassfish.api.event;
-import org.junit.Test;
-import junit.framework.Assert;
-import org.glassfish.api.event.EventTypes;
+import org.junit.jupiter.api.Test;
-public class ImmutableTest {
+import static org.junit.jupiter.api.Assertions.assertNotSame;
+import static org.junit.jupiter.api.Assertions.assertSame;
+public class EventTypesTest {
@Test
public void test1() {
@@ -30,11 +30,7 @@
EventTypes evt2 = EventTypes.create("foo");
EventTypes evt3 = EventTypes.create("foo34");
- Assert.assertNotSame(evt1, evt3);
- Assert.assertEquals(evt1, evt2);
-
- Assert.assertTrue(evt1==evt2);
- Assert.assertFalse(evt1==evt3);
+ assertNotSame(evt1, evt3);
+ assertSame(evt1, evt2);
}
-
}