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

ggregory 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 62f29d9f5 Merge some string literals
62f29d9f5 is described below

commit 62f29d9f56d1a9c7c68250a18035f62a00ba5429
Author: Gary D. Gregory <[email protected]>
AuthorDate: Sun Jul 20 17:01:53 2025 -0400

    Merge some string literals
---
 .../collections4/trie/AbstractPatriciaTrie.java    |  6 +--
 .../collection/AbstractCollectionTest.java         | 10 ++---
 .../comparators/AbstractComparatorTest.java        |  4 +-
 .../collections4/list/AbstractListTest.java        |  2 +-
 .../commons/collections4/map/AbstractMapTest.java  | 52 +++++++++++-----------
 5 files changed, 35 insertions(+), 39 deletions(-)

diff --git 
a/src/main/java/org/apache/commons/collections4/trie/AbstractPatriciaTrie.java 
b/src/main/java/org/apache/commons/collections4/trie/AbstractPatriciaTrie.java
index 7ce3da429..eead2e723 100644
--- 
a/src/main/java/org/apache/commons/collections4/trie/AbstractPatriciaTrie.java
+++ 
b/src/main/java/org/apache/commons/collections4/trie/AbstractPatriciaTrie.java
@@ -1610,17 +1610,13 @@ public abstract class AbstractPatriciaTrie<K, V> 
extends AbstractBitwiseTrie<K,
      *   key is prefixed by the search key
      */
     private SortedMap<K, V> getPrefixMapByBits(final K key, final int 
offsetInBits, final int lengthInBits) {
-
         final int offsetLength = offsetInBits + lengthInBits;
         if (offsetLength > lengthInBits(key)) {
-            throw new IllegalArgumentException(offsetInBits + " + "
-                    + lengthInBits + " > " + lengthInBits(key));
+            throw new IllegalArgumentException(offsetInBits + " + " + 
lengthInBits + " > " + lengthInBits(key));
         }
-
         if (offsetLength == 0) {
             return this;
         }
-
         return new PrefixRangeMap(key, offsetInBits, lengthInBits);
     }
 
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 617c07a9d..49e168ecf 100644
--- 
a/src/test/java/org/apache/commons/collections4/collection/AbstractCollectionTest.java
+++ 
b/src/test/java/org/apache/commons/collections4/collection/AbstractCollectionTest.java
@@ -693,10 +693,10 @@ public abstract class AbstractCollectionTest<E> extends 
AbstractObjectTest {
         resetEmpty();
         Collection<E> col = new HashSet<>();
         assertTrue(getCollection().containsAll(col),
-                "Every Collection should contain all elements of an " + "empty 
Collection.");
+                "Every Collection should contain all elements of an empty 
Collection.");
         col.addAll(Arrays.asList(getOtherElements()));
         assertFalse(getCollection().containsAll(col),
-                "Empty Collection shouldn't contain all elements of " + "a 
non-empty Collection.");
+                "Empty Collection shouldn't contain all elements of a 
non-empty Collection.");
         // make sure calls to "containsAll" don't change anything
         verify();
 
@@ -1103,10 +1103,10 @@ public abstract class AbstractCollectionTest<E> extends 
AbstractObjectTest {
         final HashSet<E> set = new HashSet<>(elements);
         size = getCollection().size();
         assertFalse(getCollection().retainAll(set),
-                "Collection shouldn't change from retainAll without " + 
"duplicate elements");
+                "Collection shouldn't change from retainAll without duplicate 
elements");
         verify();
         assertEquals(size, getCollection().size(),
-                "Collection size didn't change from nonduplicate " + 
"retainAll");
+                "Collection size didn't change from nonduplicate retainAll");
     }
 
     /**
@@ -1162,7 +1162,7 @@ public abstract class AbstractCollectionTest<E> extends 
AbstractObjectTest {
             }
         }
         for (final boolean element : matched) {
-            assertTrue(element, "Collection should return all its elements in 
" + "toArray");
+            assertTrue(element, "Collection should return all its elements in 
toArray");
         }
     }
 
diff --git 
a/src/test/java/org/apache/commons/collections4/comparators/AbstractComparatorTest.java
 
b/src/test/java/org/apache/commons/collections4/comparators/AbstractComparatorTest.java
index eadcdc8da..0551a46d5 100644
--- 
a/src/test/java/org/apache/commons/collections4/comparators/AbstractComparatorTest.java
+++ 
b/src/test/java/org/apache/commons/collections4/comparators/AbstractComparatorTest.java
@@ -121,9 +121,9 @@ public abstract class AbstractComparatorTest<T> extends 
AbstractObjectTest {
                     comparator = makeObject();
                     final String fileName = 
getCanonicalComparatorName(comparator);
                     writeExternalFormToDisk((Serializable) comparator, 
fileName);
-                    fail("Serialized form could not be found.  A serialized 
version " + "has now been written (and should be added to CVS): " + fileName);
+                    fail("Serialized form could not be found.  A serialized 
version has now been written (and should be added to CVS): " + fileName);
                 } else {
-                    fail("The Serialized form could be located to test 
serialization " + "compatibility: " + e.getMessage());
+                    fail("The Serialized form could be located to test 
serialization compatibility: " + e.getMessage());
                 }
             }
             // make sure the canonical form produces the ordering we currently
diff --git 
a/src/test/java/org/apache/commons/collections4/list/AbstractListTest.java 
b/src/test/java/org/apache/commons/collections4/list/AbstractListTest.java
index 0319a1df6..839b82d42 100644
--- a/src/test/java/org/apache/commons/collections4/list/AbstractListTest.java
+++ b/src/test/java/org/apache/commons/collections4/list/AbstractListTest.java
@@ -784,7 +784,7 @@ public abstract class AbstractListTest<E> extends 
AbstractCollectionTest<E> {
         final E[] other = getOtherElements();
         for (final E element : other) {
             assertEquals(-1, list1.lastIndexOf(element),
-                    "lastIndexOf should return -1 for nonexistent " + 
"element");
+                    "lastIndexOf should return -1 for nonexistent element");
             verify();
         }
     }
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 6e94bb30d..1fa6a5220 100644
--- a/src/test/java/org/apache/commons/collections4/map/AbstractMapTest.java
+++ b/src/test/java/org/apache/commons/collections4/map/AbstractMapTest.java
@@ -529,13 +529,13 @@ public abstract class AbstractMapTest<M extends Map<K, 
V>, K, V> extends Abstrac
             try {
                 m.put(keys[i], values[i]);
             } catch (final NullPointerException exception) {
-                assertTrue(keys[i] == null || values[i] == null, 
"NullPointerException only allowed to be thrown " + "if either the key or value 
is null.");
+                assertTrue(keys[i] == null || values[i] == null, 
"NullPointerException only allowed to be thrown if either the key or value is 
null.");
 
                 assertTrue(keys[i] == null || !isAllowNullKey(),
-                        "NullPointerException on null key, but " + 
"isAllowNullKey is not overridden to return false.");
+                        "NullPointerException on null key, but isAllowNullKey 
is not overridden to return false.");
 
                 assertTrue(values[i] == null || !isAllowNullValue(),
-                        "NullPointerException on null value, but " + 
"isAllowNullValue is not overridden to return false.");
+                        "NullPointerException on null value, but 
isAllowNullValue is not overridden to return false.");
 
                 fail("Unknown reason for NullPointer.");
             }
@@ -1350,7 +1350,7 @@ public abstract class AbstractMapTest<M extends Map<K, 
V>, K, V> extends Abstrac
         final Map<K, V> em2 = makeObject();
         assertNotNull(em, "failure in test: makeEmptyMap must return a 
non-null map.");
 
-        assertNotSame(em, em2, "failure in test: makeEmptyMap must return a 
new map " + "with each invocation.");
+        assertNotSame(em, em2, "failure in test: makeEmptyMap must return a 
new map with each invocation.");
 
         final Map<K, V> fm = makeFullMap();
         assertNotNull(fm, "failure in test: makeFullMap must return a non-null 
map.");
@@ -1358,7 +1358,7 @@ public abstract class AbstractMapTest<M extends Map<K, 
V>, K, V> extends Abstrac
         final Map<K, V> fm2 = makeFullMap();
         assertNotNull(fm2, "failure in test: makeFullMap must return a 
non-null map.");
 
-        assertNotSame(fm, fm2, "failure in test: makeFullMap must return a new 
map " + "with each invocation.");
+        assertNotSame(fm, fm2, "failure in test: makeFullMap must return a new 
map with each invocation.");
     }
 
     /**
@@ -1695,7 +1695,7 @@ public abstract class AbstractMapTest<M extends Map<K, 
V>, K, V> extends Abstrac
 
         resetFull();
         for (final Object key : keys) {
-            assertTrue(getMap().containsKey(key), "Map must contain key for a 
mapping in the map. " + "Missing: " + key);
+            assertTrue(getMap().containsKey(key), "Map must contain key for a 
mapping in the map. Missing: " + key);
         }
         verify();
     }
@@ -2161,7 +2161,7 @@ public abstract class AbstractMapTest<M extends Map<K, 
V>, K, V> extends Abstrac
         for (final Object element : other) {
             final Object o = getMap().remove(element);
             assertNull(o, "map.remove for nonexistent key should return null");
-            assertEquals(size, getMap().size(), "map.remove for nonexistent 
key should not " + "shrink map");
+            assertEquals(size, getMap().size(), "map.remove for nonexistent 
key should not shrink map");
         }
         verify();
     }
@@ -2176,7 +2176,7 @@ public abstract class AbstractMapTest<M extends Map<K, 
V>, K, V> extends Abstrac
         verify();
 
         resetFull();
-        assertEquals(getSampleKeys().length, getMap().size(), "Map.size() 
should equal the number of entries " + "in the map");
+        assertEquals(getSampleKeys().length, getMap().size(), "Map.size() 
should equal the number of entries in the map");
         verify();
     }
 
@@ -2322,13 +2322,13 @@ public abstract class AbstractMapTest<M extends Map<K, 
V>, K, V> extends Abstrac
         final Object[] values = getSampleValues();
         final Object[] newValues = getNewSampleValues();
 
-        assertNotNull(keys, "failure in test: Must have keys returned from " + 
"getSampleKeys.");
+        assertNotNull(keys, "failure in test: Must have keys returned from 
getSampleKeys.");
 
-        assertNotNull(values, "failure in test: Must have values returned from 
" + "getSampleValues.");
+        assertNotNull(values, "failure in test: Must have values returned from 
getSampleValues.");
 
         // verify keys and values have equivalent lengths (in case getSampleX 
are
         // overridden)
-        assertEquals(keys.length, values.length, "failure in test: not the 
same number of sample " + "keys and values.");
+        assertEquals(keys.length, values.length, "failure in test: not the 
same number of sample keys and values.");
 
         assertEquals(values.length, newValues.length, "failure in test: not 
the same number of values and new values.");
 
@@ -2339,9 +2339,9 @@ public abstract class AbstractMapTest<M extends Map<K, 
V>, K, V> extends Abstrac
                 assertTrue(keys[i] == null || keys[j] == null || 
!keys[i].equals(keys[j]) && !keys[j].equals(keys[i]),
                         "failure in test: duplicate non-null key.");
             }
-            assertTrue(keys[i] != null || isAllowNullKey(), "failure in test: 
found null key, but isNullKeySupported " + "is false.");
-            assertTrue(values[i] != null || isAllowNullValue(), "failure in 
test: found null value, but isNullValueSupported " + "is false.");
-            assertTrue(newValues[i] != null || isAllowNullValue(), "failure in 
test: found null new value, but isNullValueSupported " + "is false.");
+            assertTrue(keys[i] != null || isAllowNullKey(), "failure in test: 
found null key, but isNullKeySupported is false.");
+            assertTrue(values[i] != null || isAllowNullValue(), "failure in 
test: found null value, but isNullValueSupported is false.");
+            assertTrue(newValues[i] != null || isAllowNullValue(), "failure in 
test: found null new value, but isNullValueSupported is false.");
             assertTrue(values[i] != newValues[i] && (values[i] == null || 
!values[i].equals(newValues[i])),
                     "failure in test: values should not be the same as new 
value");
         }
@@ -2510,24 +2510,24 @@ public abstract class AbstractMapTest<M extends Map<K, 
V>, K, V> extends Abstrac
     public void verifyEntrySet() {
         final int size = getConfirmed().size();
         final boolean empty = getConfirmed().isEmpty();
-        assertEquals(size, entrySet.size(), "entrySet should be same size as 
HashMap's" + "\nTest: " + entrySet + "\nReal: " + getConfirmed().entrySet());
-        assertEquals(empty, entrySet.isEmpty(), "entrySet should be empty if 
HashMap is" + "\nTest: " + entrySet + "\nReal: " + getConfirmed().entrySet());
+        assertEquals(size, entrySet.size(), "entrySet should be same size as 
HashMap's\nTest: " + entrySet + "\nReal: " + getConfirmed().entrySet());
+        assertEquals(empty, entrySet.isEmpty(), "entrySet should be empty if 
HashMap is\nTest: " + entrySet + "\nReal: " + getConfirmed().entrySet());
         assertTrue(entrySet.containsAll(getConfirmed().entrySet()),
-                "entrySet should contain all HashMap's elements" + "\nTest: " 
+ entrySet + "\nReal: " + getConfirmed().entrySet());
+                "entrySet should contain all HashMap's elements\nTest: " + 
entrySet + "\nReal: " + getConfirmed().entrySet());
         assertEquals(getConfirmed().entrySet().hashCode(), entrySet.hashCode(),
-                "entrySet hashCodes should be the same" + "\nTest: " + 
entrySet + "\nReal: " + getConfirmed().entrySet());
+                "entrySet hashCodes should be the same\nTest: " + entrySet + 
"\nReal: " + getConfirmed().entrySet());
         assertEquals(getConfirmed().entrySet(), entrySet, "Map's entry set 
should still equal HashMap's");
     }
 
     public void verifyKeySet() {
         final int size = getConfirmed().size();
         final boolean empty = getConfirmed().isEmpty();
-        assertEquals(size, keySet.size(), "keySet should be same size as 
HashMap's" + "\nTest: " + keySet + "\nReal: " + getConfirmed().keySet());
-        assertEquals(empty, keySet.isEmpty(), "keySet should be empty if 
HashMap is" + "\nTest: " + keySet + "\nReal: " + getConfirmed().keySet());
+        assertEquals(size, keySet.size(), "keySet should be same size as 
HashMap's\nTest: " + keySet + "\nReal: " + getConfirmed().keySet());
+        assertEquals(empty, keySet.isEmpty(), "keySet should be empty if 
HashMap is\nTest: " + keySet + "\nReal: " + getConfirmed().keySet());
         assertTrue(keySet.containsAll(getConfirmed().keySet()),
-                "keySet should contain all HashMap's elements" + "\nTest: " + 
keySet + "\nReal: " + getConfirmed().keySet());
+                "keySet should contain all HashMap's elements\nTest: " + 
keySet + "\nReal: " + getConfirmed().keySet());
         assertEquals(getConfirmed().keySet().hashCode(), keySet.hashCode(),
-                "keySet hashCodes should be the same" + "\nTest: " + keySet + 
"\nReal: " + getConfirmed().keySet());
+                "keySet hashCodes should be the same\nTest: " + keySet + 
"\nReal: " + getConfirmed().keySet());
         assertEquals(getConfirmed().keySet(), keySet, "Map's key set should 
still equal HashMap's");
     }
 
@@ -2555,10 +2555,10 @@ public abstract class AbstractMapTest<M extends Map<K, 
V>, K, V> extends Abstrac
 
         final int size = getConfirmed().size();
         final boolean empty = getConfirmed().isEmpty();
-        assertEquals(size, values.size(), "values should be same size as 
HashMap's" + "\nTest: " + test + "\nReal: " + known);
-        assertEquals(empty, values.isEmpty(), "values should be empty if 
HashMap is" + "\nTest: " + test + "\nReal: " + known);
-        assertTrue(test.containsAll(known), "values should contain all 
HashMap's elements" + "\nTest: " + test + "\nReal: " + known);
-        assertTrue(known.containsAll(test), "values should contain all 
HashMap's elements" + "\nTest: " + test + "\nReal: " + known);
+        assertEquals(size, values.size(), "values should be same size as 
HashMap's\nTest: " + test + "\nReal: " + known);
+        assertEquals(empty, values.isEmpty(), "values should be empty if 
HashMap is\nTest: " + test + "\nReal: " + known);
+        assertTrue(test.containsAll(known), "values should contain all 
HashMap's elements\nTest: " + test + "\nReal: " + known);
+        assertTrue(known.containsAll(test), "values should contain all 
HashMap's elements\nTest: " + test + "\nReal: " + known);
         // originally coded to use a HashBag, but now separate jar so...
         for (final V v : known) {
             final boolean removed = test.remove(v);

Reply via email to