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 558f5c794 Refactor duplicate AI slop
558f5c794 is described below

commit 558f5c794d35512bac6ad27cfd59c899c737a3aa
Author: Gary Gregory <[email protected]>
AuthorDate: Sun Jun 14 12:22:58 2026 +0000

    Refactor duplicate AI slop
---
 .../org/apache/commons/collections4/bag/HashBagTest.java   | 14 --------------
 .../collections4/collection/AbstractCollectionTest.java    | 14 ++++++++++++++
 .../commons/collections4/multiset/HashMultiSetTest.java    | 14 --------------
 3 files changed, 14 insertions(+), 28 deletions(-)

diff --git a/src/test/java/org/apache/commons/collections4/bag/HashBagTest.java 
b/src/test/java/org/apache/commons/collections4/bag/HashBagTest.java
index 9b505ca5b..0f1cf262e 100644
--- a/src/test/java/org/apache/commons/collections4/bag/HashBagTest.java
+++ b/src/test/java/org/apache/commons/collections4/bag/HashBagTest.java
@@ -33,20 +33,6 @@ import org.junit.jupiter.api.Test;
  */
 public class HashBagTest<T> extends AbstractBagTest<T> {
 
-    private static void replaceInt(final byte[] bytes, final int from, final 
int to) {
-        for (int i = 0; i + 4 <= bytes.length; i++) {
-            if (((bytes[i] & 0xFF) << 24 | (bytes[i + 1] & 0xFF) << 16
-                    | (bytes[i + 2] & 0xFF) << 8 | bytes[i + 3] & 0xFF) == 
from) {
-                bytes[i] = (byte) (to >>> 24);
-                bytes[i + 1] = (byte) (to >>> 16);
-                bytes[i + 2] = (byte) (to >>> 8);
-                bytes[i + 3] = (byte) to;
-                return;
-            }
-        }
-        throw new IllegalStateException("marker not found in stream");
-    }
-
     @Override
     public String getCompatibilityVersion() {
         return "4";
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 1645d72c1..fcb5d86ec 100644
--- 
a/src/test/java/org/apache/commons/collections4/collection/AbstractCollectionTest.java
+++ 
b/src/test/java/org/apache/commons/collections4/collection/AbstractCollectionTest.java
@@ -260,6 +260,20 @@ public abstract class AbstractCollectionTest<E> extends 
AbstractObjectTest {
         }
     }
 
+    protected static void replaceInt(final byte[] bytes, final int from, final 
int to) {
+        for (int i = 0; i + 4 <= bytes.length; i++) {
+            if (((bytes[i] & 0xFF) << 24 | (bytes[i + 1] & 0xFF) << 16
+                    | (bytes[i + 2] & 0xFF) << 8 | bytes[i + 3] & 0xFF) == 
from) {
+                bytes[i] = (byte) (to >>> 24);
+                bytes[i + 1] = (byte) (to >>> 16);
+                bytes[i + 2] = (byte) (to >>> 8);
+                bytes[i + 3] = (byte) to;
+                return;
+            }
+        }
+        throw new IllegalStateException("marker not found in stream");
+    }
+
     /**
      * A collection instance that will be used for testing.
      */
diff --git 
a/src/test/java/org/apache/commons/collections4/multiset/HashMultiSetTest.java 
b/src/test/java/org/apache/commons/collections4/multiset/HashMultiSetTest.java
index 48dad2cd5..a651654da 100644
--- 
a/src/test/java/org/apache/commons/collections4/multiset/HashMultiSetTest.java
+++ 
b/src/test/java/org/apache/commons/collections4/multiset/HashMultiSetTest.java
@@ -33,20 +33,6 @@ import org.junit.jupiter.api.Test;
  */
 public class HashMultiSetTest<T> extends AbstractMultiSetTest<T> {
 
-    private static void replaceInt(final byte[] bytes, final int from, final 
int to) {
-        for (int i = 0; i + 4 <= bytes.length; i++) {
-            if (((bytes[i] & 0xFF) << 24 | (bytes[i + 1] & 0xFF) << 16
-                    | (bytes[i + 2] & 0xFF) << 8 | bytes[i + 3] & 0xFF) == 
from) {
-                bytes[i] = (byte) (to >>> 24);
-                bytes[i + 1] = (byte) (to >>> 16);
-                bytes[i + 2] = (byte) (to >>> 8);
-                bytes[i + 3] = (byte) to;
-                return;
-            }
-        }
-        throw new IllegalStateException("marker not found in stream");
-    }
-
     @Override
     public String getCompatibilityVersion() {
         return "4.1";

Reply via email to