File tree Expand file tree Collapse file tree
src/test/java/org/apache/commons/io/input Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020
2121import static org .junit .Assert .assertEquals ;
2222import static org .junit .Assert .assertTrue ;
23+ import static org .junit .Assert .assertFalse ;
2324
2425/**
2526 * Tests the CountingInputStream.
@@ -183,4 +184,24 @@ public void testResolveProxyClass() throws Exception {
183184 clois .close ();
184185 }
185186
187+ @ org .junit .Test
188+ public void testResolveProxyClassWithMultipleInterfaces () throws Exception {
189+
190+ final ByteArrayOutputStream baos = new ByteArrayOutputStream ();
191+ final ObjectOutputStream oos = new ObjectOutputStream (baos );
192+ oos .writeObject (Boolean .FALSE );
193+ final InputStream bais = new ByteArrayInputStream (baos .toByteArray ());
194+
195+ final ClassLoaderObjectInputStream clois =
196+ new ClassLoaderObjectInputStream (getClass ().getClassLoader (), bais );
197+ final String [] interfaces = new String []{Comparable .class .getName (),
198+ Serializable .class .getName (),
199+ Runnable .class .getName ()};
200+ final Class <?> result = clois .resolveProxyClass (interfaces );
201+ assertTrue ("Assignable" , Comparable .class .isAssignableFrom (result ));
202+ assertTrue ("Assignable" , Runnable .class .isAssignableFrom (result ));
203+ assertTrue ("Assignable" , Serializable .class .isAssignableFrom (result ));
204+ assertFalse ("Not Assignable" , Flushable .class .isAssignableFrom (result ));
205+ clois .close ();
206+ }
186207}
You can’t perform that action at this time.
0 commit comments