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 2e3ef3c8675c9b4b8ccd7f8ca3497817f415c35d
Author: Gary Gregory <[email protected]>
AuthorDate: Sat Jun 27 13:51:56 2026 +0000

    Reduce copy-pasta in tests.
---
 .../collections4/collection/PredicatedCollectionTest.java  | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git 
a/src/test/java/org/apache/commons/collections4/collection/PredicatedCollectionTest.java
 
b/src/test/java/org/apache/commons/collections4/collection/PredicatedCollectionTest.java
index ad5effd7d..e35f68730 100644
--- 
a/src/test/java/org/apache/commons/collections4/collection/PredicatedCollectionTest.java
+++ 
b/src/test/java/org/apache/commons/collections4/collection/PredicatedCollectionTest.java
@@ -19,11 +19,7 @@ package org.apache.commons.collections4.collection;
 import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
 import java.io.InvalidObjectException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -91,15 +87,7 @@ public class PredicatedCollectionTest<E> extends 
AbstractCollectionTest<E> {
         // a crafted stream can carry an element that never passed add(); 
mimic it by
         // writing one straight into the decorated collection
         coll.decorated().add(null);
-        final ByteArrayOutputStream out = new ByteArrayOutputStream();
-        try (ObjectOutputStream oos = new ObjectOutputStream(out)) {
-            oos.writeObject(coll);
-        }
-        assertThrows(InvalidObjectException.class, () -> {
-            try (ObjectInputStream ois = new ObjectInputStream(new 
ByteArrayInputStream(out.toByteArray()))) {
-                ois.readObject();
-            }
-        });
+        assertThrows(InvalidObjectException.class, () -> 
serializeDeserialize(coll));
     }
 
     @Test

Reply via email to