commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brit...@apache.org
Subject [1/2] commons-io git commit: added test to exercise ClassLoaderObjectInputStream::resolveProxyClass with multiple interfaces
Date Tue, 26 Sep 2017 06:59:15 GMT
Repository: commons-io
Updated Branches:
  refs/heads/master dc78df16d -> 4f6b009a2


added test to exercise ClassLoaderObjectInputStream::resolveProxyClass with multiple interfaces


Project: http://git-wip-us.apache.org/repos/asf/commons-io/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-io/commit/4d5e45cd
Tree: http://git-wip-us.apache.org/repos/asf/commons-io/tree/4d5e45cd
Diff: http://git-wip-us.apache.org/repos/asf/commons-io/diff/4d5e45cd

Branch: refs/heads/master
Commit: 4d5e45cdb44f61202ce439caa3d417813375f9b7
Parents: 733dc26
Author: Owolabi Legunsen <legunse2@illinois.edu>
Authored: Mon Sep 25 14:39:34 2017 -0500
Committer: Owolabi Legunsen <legunse2@illinois.edu>
Committed: Mon Sep 25 14:39:34 2017 -0500

----------------------------------------------------------------------
 .../input/ClassLoaderObjectInputStreamTest.java | 21 ++++++++++++++++++++
 1 file changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-io/blob/4d5e45cd/src/test/java/org/apache/commons/io/input/ClassLoaderObjectInputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/io/input/ClassLoaderObjectInputStreamTest.java
b/src/test/java/org/apache/commons/io/input/ClassLoaderObjectInputStreamTest.java
index 8730bff..d48d57a 100644
--- a/src/test/java/org/apache/commons/io/input/ClassLoaderObjectInputStreamTest.java
+++ b/src/test/java/org/apache/commons/io/input/ClassLoaderObjectInputStreamTest.java
@@ -20,6 +20,7 @@ import java.io.*;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
 
 /**
  * Tests the CountingInputStream.
@@ -183,4 +184,24 @@ public class ClassLoaderObjectInputStreamTest {
         clois.close();
     }
 
+    @org.junit.Test
+    public void testResolveProxyClassWithMultipleInterfaces() throws Exception {
+
+        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        final ObjectOutputStream oos = new ObjectOutputStream(baos);
+        oos.writeObject(Boolean.FALSE);
+        final InputStream bais = new ByteArrayInputStream(baos.toByteArray());
+
+        final ClassLoaderObjectInputStream clois =
+                new ClassLoaderObjectInputStream(getClass().getClassLoader(), bais);
+        final String[] interfaces = new String[]{Comparable.class.getName(),
+                                                 Serializable.class.getName(),
+                                                 Runnable.class.getName()};
+        final Class<?> result = clois.resolveProxyClass(interfaces);
+        assertTrue("Assignable", Comparable.class.isAssignableFrom(result));
+        assertTrue("Assignable", Runnable.class.isAssignableFrom(result));
+        assertTrue("Assignable", Serializable.class.isAssignableFrom(result));
+        assertFalse("Not Assignable", Flushable.class.isAssignableFrom(result));
+        clois.close();
+    }
 }


Mime
View raw message