rootvector2 commented on code in PR #718:
URL: 
https://github.com/apache/commons-collections/pull/718#discussion_r3673980751


##########
src/test/java/org/apache/commons/collections4/SplitMapUtilsTest.java:
##########
@@ -116,12 +116,14 @@ void testReadableMap() {
         assertEquals(other, map);
         assertEquals(other.hashCode(), map.hashCode());
 
-        // remove
-        for (int i = 0; i < 10; i++) {
-            assertEquals(i, map.remove(String.valueOf(i)).intValue());
-            assertEquals(--sz, map.size());
-        }
-        assertTrue(map.isEmpty());
+        // remove, and the Map default methods that route through it
+        attemptPutOperation(() -> map.remove("0"));
+        attemptPutOperation(() -> map.remove("1", 1));
+        attemptPutOperation(() -> map.computeIfPresent("2", (k, v) -> null));
+        attemptPutOperation(() -> map.merge("3", 3, (a, b) -> null));
+
+        assertEquals(sz, map.size());
+        assertEquals(sz, backingMap.size());

Review Comment:
   done in 65ab724, `compute` is now guarded alongside the others; moved 
`merge` to key `"4"` so each call hits its own live mapping.



##########
src/main/java/org/apache/commons/collections4/SplitMapUtils.java:
##########
@@ -131,9 +131,15 @@ public void putAll(final Map<? extends K, ? extends V> 
map) {
             throw new UnsupportedOperationException();
         }
 
+        /**
+         * Always throws {@link UnsupportedOperationException}.
+         *
+         * @param key Ignored.
+         * @throws UnsupportedOperationException Always thrown.
+         */
         @Override
         public V remove(final Object key) {
-            return get.remove(key);
+            throw new UnsupportedOperationException();

Review Comment:
   reworded in 65ab724 to describe the key instead of calling it ignored.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to