This is an automated email from the ASF dual-hosted git repository.

garydgregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git


The following commit(s) were added to refs/heads/master by this push:
     new 84a89a5b6 COLLECTIONS-884 Add missing nested test wrappers (#689)
84a89a5b6 is described below

commit 84a89a5b6f29c82dd04b154cb08157f3f17c07d3
Author: sankalp suman <[email protected]>
AuthorDate: Sat Jun 20 22:14:31 2026 +0530

    COLLECTIONS-884 Add missing nested test wrappers (#689)
---
 .../collection/AbstractCollectionTest.java            |  4 ++--
 .../commons/collections4/map/AbstractMapTest.java     | 12 ++++++------
 .../commons/collections4/map/CompositeMapTest.java    | 12 ++++++++++++
 .../collections4/map/ConcurrentHashMapSanityTest.java | 19 ++++++++++++++-----
 4 files changed, 34 insertions(+), 13 deletions(-)

diff --git 
a/src/test/java/org/apache/commons/collections4/collection/AbstractCollectionTest.java
 
b/src/test/java/org/apache/commons/collections4/collection/AbstractCollectionTest.java
index fcb5d86ec..349c6fac6 100644
--- 
a/src/test/java/org/apache/commons/collections4/collection/AbstractCollectionTest.java
+++ 
b/src/test/java/org/apache/commons/collections4/collection/AbstractCollectionTest.java
@@ -1316,7 +1316,7 @@ public abstract class AbstractCollectionTest<E> extends 
AbstractObjectTest {
      *  raise <code>UnsupportedOperationException.
      */
     @Test
-    void testUnsupportedAdd() {
+    public void testUnsupportedAdd() {
         if (isAddSupported()) {
             return;
         }
@@ -1353,7 +1353,7 @@ public abstract class AbstractCollectionTest<E> extends 
AbstractObjectTest {
      *  operations raise an UnsupportedOperationException.
      */
     @Test
-    void testUnsupportedRemove() {
+    public void testUnsupportedRemove() {
         if (isRemoveSupported()) {
             return;
         }
diff --git 
a/src/test/java/org/apache/commons/collections4/map/AbstractMapTest.java 
b/src/test/java/org/apache/commons/collections4/map/AbstractMapTest.java
index 24b589be7..6a25079fd 100644
--- a/src/test/java/org/apache/commons/collections4/map/AbstractMapTest.java
+++ b/src/test/java/org/apache/commons/collections4/map/AbstractMapTest.java
@@ -139,7 +139,8 @@ import org.junit.jupiter.api.Test;
  */
 public abstract class AbstractMapTest<M extends Map<K, V>, K, V> extends 
AbstractObjectTest {
 
-    public abstract class MapEntrySetTest extends AbstractSetTest<Map.Entry<K, 
V>> {
+    @Nested
+    public class MapEntrySetTest extends AbstractSetTest<Map.Entry<K, V>> {
 
         @Override
         public boolean areEqualElementsDistinguishable() {
@@ -401,7 +402,8 @@ public abstract class AbstractMapTest<M extends Map<K, V>, 
K, V> extends Abstrac
     // to the confirmed, that the already-constructed collection views
     // are still equal to the confirmed's collection views.
 
-    public abstract class MapValuesTest extends AbstractCollectionTest<V> {
+    @Nested
+    public class MapValuesTest extends AbstractCollectionTest<V> {
 
         @Override
         public boolean areEqualElementsDistinguishable() {
@@ -556,8 +558,7 @@ public abstract class AbstractMapTest<M extends Map<K, V>, 
K, V> extends Abstrac
      * @return a {@link AbstractSetTest} instance for testing the map's entry 
set
      */
     public BulkTest bulkTestMapEntrySet() {
-        return new MapEntrySetTest() {
-        };
+        return new MapEntrySetTest();
     }
 
     /**
@@ -577,8 +578,7 @@ public abstract class AbstractMapTest<M extends Map<K, V>, 
K, V> extends Abstrac
      * @return a {@link AbstractCollectionTest} instance for testing the map's 
values collection
      */
     public BulkTest bulkTestMapValues() {
-        return new MapValuesTest() {
-        };
+        return new MapValuesTest();
     }
 
     /**
diff --git 
a/src/test/java/org/apache/commons/collections4/map/CompositeMapTest.java 
b/src/test/java/org/apache/commons/collections4/map/CompositeMapTest.java
index fbec8a01e..c8c128011 100644
--- a/src/test/java/org/apache/commons/collections4/map/CompositeMapTest.java
+++ b/src/test/java/org/apache/commons/collections4/map/CompositeMapTest.java
@@ -26,6 +26,7 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Nested;
 import org.junit.jupiter.api.Test;
 
 /**
@@ -36,6 +37,17 @@ import org.junit.jupiter.api.Test;
  */
 public class CompositeMapTest<K, V> extends AbstractIterableMapTest<K, V> {
 
+    @Nested
+    public class MapValuesTest extends AbstractMapTest.MapValuesTest {
+        @Test
+        @Override
+        public void testUnsupportedRemove() {
+            resetFull();
+            assertThrows(UnsupportedOperationException.class, () -> 
getCollection().remove(null));
+            verify();
+        }
+    }
+
     /** Used as a flag in MapMutator tests */
     private boolean pass;
 
diff --git 
a/src/test/java/org/apache/commons/collections4/map/ConcurrentHashMapSanityTest.java
 
b/src/test/java/org/apache/commons/collections4/map/ConcurrentHashMapSanityTest.java
index 0b7ff805f..b539b8086 100644
--- 
a/src/test/java/org/apache/commons/collections4/map/ConcurrentHashMapSanityTest.java
+++ 
b/src/test/java/org/apache/commons/collections4/map/ConcurrentHashMapSanityTest.java
@@ -19,6 +19,9 @@ package org.apache.commons.collections4.map;
 
 import java.util.concurrent.ConcurrentHashMap;
 
+import org.junit.jupiter.api.Nested;
+import org.junit.jupiter.api.Test;
+
 /**
  * A sanity test for the test framework.
  *
@@ -42,11 +45,6 @@ public class ConcurrentHashMapSanityTest<K, V> extends 
AbstractMapTest<Concurren
         return false;
     }
 
-    @Override
-    public boolean isEntrySetAddSupported() {
-        return true;
-    }
-
     /**
      * Don't test, just a sanity check for the test framework.
      */
@@ -55,6 +53,17 @@ public class ConcurrentHashMapSanityTest<K, V> extends 
AbstractMapTest<Concurren
         return false;
     }
 
+    @Nested
+    public class MapEntrySetTest extends AbstractMapTest.MapEntrySetTest {
+        @Test
+        @Override
+        public void testUnsupportedAdd() {
+            resetEmpty();
+            // ConcurrentHashMap.entrySet() supports add.
+            getCollection().add(getFullNonNullElements()[0]);
+        }
+    }
+
     @Override
     public ConcurrentHashMap<K, V> makeObject() {
         return new ConcurrentHashMap<>();

Reply via email to