You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by tn...@apache.org on 2015/11/14 14:24:25 UTC

svn commit: r1714318 - in /commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4: FactoryUtilsTest.java TransformerUtilsTest.java

Author: tn
Date: Sat Nov 14 13:24:24 2015
New Revision: 1714318

URL: http://svn.apache.org/viewvc?rev=1714318&view=rev
Log:
[COLLECTIONS-580] Remove serialization tests for classes which are not serializable anymore.

Modified:
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/FactoryUtilsTest.java
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/TransformerUtilsTest.java

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/FactoryUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/FactoryUtilsTest.java?rev=1714318&r1=1714317&r2=1714318&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/FactoryUtilsTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/FactoryUtilsTest.java Sat Nov 14 13:24:24 2015
@@ -16,14 +16,14 @@
  */
 package org.apache.commons.collections4;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
 import java.io.IOException;
-import java.io.NotSerializableException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
 import java.io.Serializable;
 import java.util.Date;
 import java.util.TimeZone;
@@ -106,15 +106,6 @@ public class FactoryUtilsTest {
         final Date created = factory.create();
         assertTrue(proto != created);
         assertEquals(proto, created);
-
-        // check serialisation works
-        final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
-        final ObjectOutputStream out = new ObjectOutputStream(buffer);
-        out.writeObject(factory);
-        out.close();
-        final ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
-        in.readObject();
-        in.close();
     }
 
     @Test
@@ -125,23 +116,6 @@ public class FactoryUtilsTest {
         final Object created = factory.create();
         assertTrue(proto != created);
         assertEquals(proto, created);
-
-        // check serialisation works
-        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
-        ObjectOutputStream out = new ObjectOutputStream(buffer);
-        try {
-            out.writeObject(factory);
-        } catch (final NotSerializableException ex) {
-            out.close();
-        }
-        factory = FactoryUtils.<Object>prototypeFactory(new Mock2("S"));
-        buffer = new ByteArrayOutputStream();
-        out = new ObjectOutputStream(buffer);
-        out.writeObject(factory);
-        out.close();
-        final ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
-        in.readObject();
-        in.close();
     }
 
     @Test
@@ -152,15 +126,6 @@ public class FactoryUtilsTest {
         final Integer created = factory.create();
         assertTrue(proto != created);
         assertEquals(proto, created);
-
-        // check serialisation works
-        final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
-        final ObjectOutputStream out = new ObjectOutputStream(buffer);
-        out.writeObject(factory);
-        out.close();
-        final ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
-        in.readObject();
-        in.close();
     }
 
     @Test

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/TransformerUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/TransformerUtilsTest.java?rev=1714318&r1=1714317&r2=1714318&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/TransformerUtilsTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/TransformerUtilsTest.java Sat Nov 14 13:24:24 2015
@@ -16,7 +16,10 @@
  */
 package org.apache.commons.collections4;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.fail;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -26,7 +29,6 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.commons.collections4.functors.CloneTransformer;
 import org.apache.commons.collections4.functors.ConstantTransformer;
 import org.apache.commons.collections4.functors.EqualPredicate;
 import org.apache.commons.collections4.functors.ExceptionTransformer;
@@ -247,6 +249,7 @@ public class TransformerUtilsTest {
         assertEquals("B", TransformerUtils.ifTransformer(FalsePredicate.falsePredicate(), a, b).transform(null));
 
         Predicate<Integer> lessThanFivePredicate = new Predicate<Integer>() {
+            @Override
             public boolean evaluate(Integer value) {
                 return value < 5;
             }
@@ -481,7 +484,6 @@ public class TransformerUtilsTest {
     @Test
     public void testSingletonPatternInSerialization() {
         final Object[] singletones = new Object[] {
-                CloneTransformer.INSTANCE,
                 ExceptionTransformer.INSTANCE,
                 NOPTransformer.INSTANCE,
                 StringValueTransformer.stringValueTransformer(),