This is an automated email from the ASF dual-hosted git repository.
enorman pushed a commit to branch master
in repository
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-installer-factory-configuration.git
The following commit(s) were added to refs/heads/master by this push:
new ca64278 SLING-13164 Migrate tests to junit 5 (#22)
ca64278 is described below
commit ca64278a875367e57f8da942de848d9a08db2396
Author: Eric Norman <[email protected]>
AuthorDate: Wed Apr 8 14:19:59 2026 -0700
SLING-13164 Migrate tests to junit 5 (#22)
---
pom.xml | 9 +++++++--
.../impl/ConfigUpdateHandlerTest.java | 10 +++++-----
.../configuration/impl/ConfigUtilTest.java | 22 +++++++++++-----------
.../configuration/impl/MetatypeHandlerTest.java | 8 ++++----
.../configuration/impl/SortedDictionaryTest.java | 18 +++++++++---------
5 files changed, 36 insertions(+), 31 deletions(-)
diff --git a/pom.xml b/pom.xml
index c4038f9..1c148e5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -129,8 +129,13 @@
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git
a/src/test/java/org/apache/sling/installer/factories/configuration/impl/ConfigUpdateHandlerTest.java
b/src/test/java/org/apache/sling/installer/factories/configuration/impl/ConfigUpdateHandlerTest.java
index 38078e7..807048c 100644
---
a/src/test/java/org/apache/sling/installer/factories/configuration/impl/ConfigUpdateHandlerTest.java
+++
b/src/test/java/org/apache/sling/installer/factories/configuration/impl/ConfigUpdateHandlerTest.java
@@ -18,11 +18,11 @@
*/
package org.apache.sling.installer.factories.configuration.impl;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
-public class ConfigUpdateHandlerTest {
+class ConfigUpdateHandlerTest {
private void checkFactoryPid(final String alias, final String oldId, final
String factoryId, final String pid) {
final ConfigUpdateHandler cuh = new ConfigUpdateHandler(null, null);
@@ -32,7 +32,7 @@ public class ConfigUpdateHandlerTest {
}
@Test
- public void testGettingFactoryPid() {
+ void testGettingFactoryPid() {
// normal conversion
checkFactoryPid(
"org.apache.sling.jcr.base.internal.LoginAdminWhitelist.fragment.org.apache.sling.jcr.base.internal.LoginAdminWhitelist.fragment.43e4778d-3e72-460a-9da9-bca80558f1f7",
@@ -64,7 +64,7 @@ public class ConfigUpdateHandlerTest {
}
@Test
- public void testDuplicateFactoryPID() {
+ void testDuplicateFactoryPID() {
checkFactoryPid(
"a.b.c.MyFactoryConfig.a.b.c.MyFactoryConfig.5a61b4ab-c8c9-4e20-ab3d-b8b7ea12dfca",
"a.b.c.MyFactoryConfig.a.b.c.MyFactoryConfig",
diff --git
a/src/test/java/org/apache/sling/installer/factories/configuration/impl/ConfigUtilTest.java
b/src/test/java/org/apache/sling/installer/factories/configuration/impl/ConfigUtilTest.java
index 88a5c28..1834b26 100644
---
a/src/test/java/org/apache/sling/installer/factories/configuration/impl/ConfigUtilTest.java
+++
b/src/test/java/org/apache/sling/installer/factories/configuration/impl/ConfigUtilTest.java
@@ -22,19 +22,19 @@ import java.util.Dictionary;
import java.util.Enumeration;
import java.util.Hashtable;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.osgi.service.cm.Configuration;
import org.osgi.service.cm.ConfigurationAdmin;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
-public class ConfigUtilTest {
+class ConfigUtilTest {
@Test
- public void testIsSameDataEmptyAndNullDictionaries() throws Exception {
+ void testIsSameDataEmptyAndNullDictionaries() {
final Dictionary<String, Object> a = new Hashtable<>();
final Dictionary<String, Object> b = new Hashtable<>();
@@ -46,7 +46,7 @@ public class ConfigUtilTest {
}
@Test
- public void testIsSameDataSameDictionaries() throws Exception {
+ void testIsSameDataSameDictionaries() {
final Dictionary<String, Object> a = new Hashtable<>();
final Dictionary<String, Object> b = new Hashtable<>();
@@ -76,7 +76,7 @@ public class ConfigUtilTest {
}
@Test
- public void testIsSameDataArrays() throws Exception {
+ void testIsSameDataArrays() {
final Dictionary<String, Object> a = new Hashtable<>();
final Dictionary<String, Object> b = new Hashtable<>();
@@ -97,7 +97,7 @@ public class ConfigUtilTest {
}
@Test
- public void testIsSameDataWithPrimitiveArrays() throws Exception {
+ void testIsSameDataWithPrimitiveArrays() {
final Dictionary<String, Object> a = new Hashtable<>();
final Dictionary<String, Object> b = new Hashtable<>();
@@ -115,7 +115,7 @@ public class ConfigUtilTest {
}
@Test
- public void testGetOrCreateConfiguration() throws Exception {
+ void testGetOrCreateConfiguration() throws Exception {
Configuration c1 = Mockito.mock(Configuration.class);
ConfigurationAdmin cm = Mockito.mock(ConfigurationAdmin.class);
Mockito.when(cm.listConfigurations("(&(service.factoryPid=a.b.c)(service.pid=a.b.c~c1))"))
@@ -125,7 +125,7 @@ public class ConfigUtilTest {
}
@Test
- public void testIsSameDataWithSwitchFromArrayToSingleValue() throws
Exception {
+ void testIsSameDataWithSwitchFromArrayToSingleValue() {
final Dictionary<String, Object> a = new Hashtable<>();
final Dictionary<String, Object> b = new Hashtable<>();
diff --git
a/src/test/java/org/apache/sling/installer/factories/configuration/impl/MetatypeHandlerTest.java
b/src/test/java/org/apache/sling/installer/factories/configuration/impl/MetatypeHandlerTest.java
index 3eff9bf..1db2152 100644
---
a/src/test/java/org/apache/sling/installer/factories/configuration/impl/MetatypeHandlerTest.java
+++
b/src/test/java/org/apache/sling/installer/factories/configuration/impl/MetatypeHandlerTest.java
@@ -22,7 +22,7 @@ import java.util.Arrays;
import java.util.Dictionary;
import java.util.Hashtable;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -31,12 +31,12 @@ import org.osgi.service.metatype.MetaTypeInformation;
import org.osgi.service.metatype.MetaTypeService;
import org.osgi.service.metatype.ObjectClassDefinition;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
-public class MetatypeHandlerTest {
+class MetatypeHandlerTest {
@Test
- public void testUpdateConfiguration() throws Exception {
+ void testUpdateConfiguration() {
final BundleContext bundleContext = Mockito.mock(BundleContext.class);
final MetaTypeService mts = Mockito.mock(MetaTypeService.class);
final Bundle bundle = Mockito.mock(Bundle.class);
diff --git
a/src/test/java/org/apache/sling/installer/factories/configuration/impl/SortedDictionaryTest.java
b/src/test/java/org/apache/sling/installer/factories/configuration/impl/SortedDictionaryTest.java
index 9c2cbd5..b9fc963 100644
---
a/src/test/java/org/apache/sling/installer/factories/configuration/impl/SortedDictionaryTest.java
+++
b/src/test/java/org/apache/sling/installer/factories/configuration/impl/SortedDictionaryTest.java
@@ -22,16 +22,16 @@ import java.util.Collections;
import java.util.Dictionary;
import java.util.Hashtable;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
-public class SortedDictionaryTest {
+class SortedDictionaryTest {
@Test
- public void testKeysAndElements() {
+ void testKeysAndElements() {
Dictionary<String, Object> dictionary = new Hashtable<>();
dictionary.put("Z", "z");
dictionary.put("A", "a");
@@ -46,7 +46,7 @@ public class SortedDictionaryTest {
}
@Test
- public void testPutGetRemove() {
+ void testPutGetRemove() {
Dictionary<String, Object> dictionary = new Hashtable<>();
Dictionary<String, Object> sortedDictionary = new
SortedDictionary<>(dictionary);
sortedDictionary.put("foo", "bar");
@@ -58,7 +58,7 @@ public class SortedDictionaryTest {
}
@Test
- public void testDelegatedGetters() {
+ void testDelegatedGetters() {
Dictionary<String, Object> dictionary = new Hashtable<>();
dictionary.put("foo", "bar");
dictionary.put("bar", "baz");
@@ -69,7 +69,7 @@ public class SortedDictionaryTest {
}
@Test
- public void testEqualsAndHashcode() {
+ void testEqualsAndHashcode() {
Dictionary<String, Object> dictionary = new Hashtable<>();
dictionary.put("foo", "bar");
dictionary.put("bar", "baz");