You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2026/07/30 10:19:41 UTC
(commons-collections) branch master updated (a1496edc7 -> 59cd8f968)
This is an automated email from the ASF dual-hosted git repository.
garydgregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git
from a1496edc7 Keep OrderedProperties keySet and values in sync with the map (#719)
new e41107dd7 Sort members
new 99deb3028 Add org.apache.commons.collections4.properties.OrderedPropertiesTest.testKeySetRejectsAddAll()
new 59cd8f968 Keep OrderedProperties keySet and values in sync with the map (#719).
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
src/changes/changes.xml | 3 ++-
.../multimap/AbstractMultiValuedMapTest.java | 26 ++++++++++----------
.../properties/OrderedPropertiesTest.java | 28 +++++++++++++++-------
3 files changed, 34 insertions(+), 23 deletions(-)
(commons-collections) 02/03: Add org.apache.commons.collections4.properties.OrderedPropertiesTest.testKeySetRejectsAddAll()
Posted by gg...@apache.org.
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
commit 99deb3028d4c5258576cb87d2ad830220103e413
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Jul 30 06:18:47 2026 -0400
Add org.apache.commons.collections4.properties.OrderedPropertiesTest.testKeySetRejectsAddAll()
---
.../commons/collections4/properties/OrderedPropertiesTest.java | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/test/java/org/apache/commons/collections4/properties/OrderedPropertiesTest.java b/src/test/java/org/apache/commons/collections4/properties/OrderedPropertiesTest.java
index 90c472fb0..c983ff952 100644
--- a/src/test/java/org/apache/commons/collections4/properties/OrderedPropertiesTest.java
+++ b/src/test/java/org/apache/commons/collections4/properties/OrderedPropertiesTest.java
@@ -25,6 +25,7 @@ import static org.junit.jupiter.params.provider.Arguments.arguments;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Iterator;
@@ -241,6 +242,15 @@ class OrderedPropertiesTest {
assertEquals("{key1=value1, key2=value2, key3=value3}", orderedProperties.toString());
}
+ @Test
+ void testKeySetRejectsAddAll() {
+ final OrderedProperties orderedProperties = newThreeKeyProperties();
+ final Set<Object> keySet = orderedProperties.keySet();
+ assertThrows(UnsupportedOperationException.class, () -> keySet.addAll(Arrays.asList("key4")));
+ assertEquals("[key1, key2, key3]", orderedProperties.keySet().toString());
+ assertEquals("{key1=value1, key2=value2, key3=value3}", orderedProperties.toString());
+ }
+
@Test
void testLoadOrderedKeys() throws IOException {
final OrderedProperties orderedProperties = new OrderedProperties();
(commons-collections) 01/03: Sort members
Posted by gg...@apache.org.
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
commit e41107dd7a7759acfbcd3ba973b24591473bce15
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Jul 30 06:17:36 2026 -0400
Sort members
---
.../multimap/AbstractMultiValuedMapTest.java | 26 +++++++++++-----------
.../properties/OrderedPropertiesTest.java | 18 +++++++--------
2 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java b/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java
index 890bffdef..80b5f53c2 100644
--- a/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java
+++ b/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java
@@ -683,6 +683,19 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
this.confirmed = confirmed;
}
+ @Test
+ @SuppressWarnings("unchecked")
+ void testAddAllThroughGetEmptyLeavesKeyAbsent() {
+ assumeTrue(isAddSupported());
+ resetEmpty();
+ final MultiValuedMap<K, V> map = getMap();
+ final Collection<V> col = map.get((K) "k0");
+ assertFalse(col.addAll(new ArrayList<>()));
+ assertFalse(map.containsKey("k0"));
+ assertFalse(map.keySet().contains("k0"));
+ assertEquals(0, map.size());
+ }
+
@Test
@SuppressWarnings("unchecked")
void testAddMappingThroughGet() {
@@ -705,19 +718,6 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
assertTrue(col2.contains("v1_1"));
}
- @Test
- @SuppressWarnings("unchecked")
- void testAddAllThroughGetEmptyLeavesKeyAbsent() {
- assumeTrue(isAddSupported());
- resetEmpty();
- final MultiValuedMap<K, V> map = getMap();
- final Collection<V> col = map.get((K) "k0");
- assertFalse(col.addAll(new ArrayList<>()));
- assertFalse(map.containsKey("k0"));
- assertFalse(map.keySet().contains("k0"));
- assertEquals(0, map.size());
- }
-
/*void testRemoveViaGetCollectionRemove() {
if (!isRemoveSupported()) {
return;
diff --git a/src/test/java/org/apache/commons/collections4/properties/OrderedPropertiesTest.java b/src/test/java/org/apache/commons/collections4/properties/OrderedPropertiesTest.java
index 40476f111..90c472fb0 100644
--- a/src/test/java/org/apache/commons/collections4/properties/OrderedPropertiesTest.java
+++ b/src/test/java/org/apache/commons/collections4/properties/OrderedPropertiesTest.java
@@ -218,15 +218,6 @@ class OrderedPropertiesTest {
});
}
- @Test
- void testKeySetRejectsAdd() {
- final OrderedProperties orderedProperties = newThreeKeyProperties();
- final Set<Object> keySet = orderedProperties.keySet();
- assertThrows(UnsupportedOperationException.class, () -> keySet.add("key4"));
- assertEquals("[key1, key2, key3]", orderedProperties.keySet().toString());
- assertEquals("{key1=value1, key2=value2, key3=value3}", orderedProperties.toString());
- }
-
@Test
void testKeys() {
final OrderedProperties orderedProperties = new OrderedProperties();
@@ -241,6 +232,15 @@ class OrderedPropertiesTest {
}
}
+ @Test
+ void testKeySetRejectsAdd() {
+ final OrderedProperties orderedProperties = newThreeKeyProperties();
+ final Set<Object> keySet = orderedProperties.keySet();
+ assertThrows(UnsupportedOperationException.class, () -> keySet.add("key4"));
+ assertEquals("[key1, key2, key3]", orderedProperties.keySet().toString());
+ assertEquals("{key1=value1, key2=value2, key3=value3}", orderedProperties.toString());
+ }
+
@Test
void testLoadOrderedKeys() throws IOException {
final OrderedProperties orderedProperties = new OrderedProperties();
(commons-collections) 03/03: Keep OrderedProperties keySet and values in sync with the map (#719).
Posted by gg...@apache.org.
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
commit 59cd8f9684f64f4eca68afc3bff683a58e1399d7
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Jul 30 06:19:35 2026 -0400
Keep OrderedProperties keySet and values in sync with the map (#719).
---
src/changes/changes.xml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index a197e6439..d13c693fd 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -85,7 +85,8 @@
<action type="fix" dev="ggregory" due-to="Naveed Khan, Gary Gregory">Do not register a value collection until an add succeeds (#717).</action>
<action type="fix" dev="ggregory" due-to="Naveed Khan, Gary Gregory">Increment modCount after the bounds check in TreeList add and remove (#716).</action>
<action type="fix" dev="ggregory" due-to="Gary Gregory">Add messages when throwing NullPointerException.</action>
- <action type="fix" dev="ggregory" due-to="Naveed Khan, Gary Gregory">Reject remove on the Unmodifiable map from SplitMapUtils.readableMap (#718)</action>
+ <action type="fix" dev="ggregory" due-to="Naveed Khan, Gary Gregory">Reject remove on the Unmodifiable map from SplitMapUtils.readableMap (#718).</action>
+ <action type="fix" dev="ggregory" due-to="Naveed Khan, Gary Gregory">Keep OrderedProperties keySet and values in sync with the map (#719).</action>
<!-- ADD -->
<action type="add" dev="ggregory" due-to="Gary Gregory">Add generics to UnmodifiableIterator for the wrapped type.</action>
<action type="add" dev="ggregory" due-to="Gary Gregory">Add a Maven benchmark profile for JMH.</action>