|
20 | 20 |
|
21 | 21 | import static org.junit.Assert.assertEquals; |
22 | 22 | import static org.junit.Assert.assertTrue; |
| 23 | +import static org.junit.Assert.assertFalse; |
23 | 24 |
|
24 | 25 | /** |
25 | 26 | * Tests the CountingInputStream. |
@@ -183,4 +184,24 @@ public void testResolveProxyClass() throws Exception { |
183 | 184 | clois.close(); |
184 | 185 | } |
185 | 186 |
|
| 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 | + } |
186 | 207 | } |
0 commit comments