@Test public void useCustomClassLoaderToResolveClass() throws Exception { String name = "testClassName"; when(classDescription.getName()).thenReturn(name); doReturn(getClass()).when(classLoader).loadClass(anyString()); try (ObjectInputStreamWithClassLoader underTest = new ObjectInputStreamWithClassLoader( serialize(OBJECT_TO_SERIALIZE), classLoader)) { underTest.resolveClass(classDescription); } catch (Exception e){ } verify(classLoader).loadClass(name); }
@Override protected Class<?> resolveClass(final ObjectStreamClass classDesc) throws ClassNotFoundException { return classLoading.loadClass(classDesc.getName()); }
ObjectInputStreamWithClassLoader extends ObjectInputStream { @Override protected Class<?> resolveClass(final ObjectStreamClass classDesc) throws ClassNotFoundException { return classLoading.loadClass(classDesc.getName()); } }
ObjectInputStreamWithClassLoader extends ObjectInputStream { @Override protected Class<?> resolveClass(final ObjectStreamClass classDesc) throws ClassNotFoundException { return classLoading.loadClass(classDesc.getName()); } ObjectInputStreamWithClassLoader(final InputStream inputStream, final LoadingFunction classLoading);  ObjectInputStreamWithClassLoader(final InputStream inputStream, final ClassLoader loader); }
ObjectInputStreamWithClassLoader extends ObjectInputStream { @Override protected Class<?> resolveClass(final ObjectStreamClass classDesc) throws ClassNotFoundException { return classLoading.loadClass(classDesc.getName()); } ObjectInputStreamWithClassLoader(final InputStream inputStream, final LoadingFunction classLoading);  ObjectInputStreamWithClassLoader(final InputStream inputStream, final ClassLoader loader);  }
ObjectInputStreamWithClassLoader extends ObjectInputStream { @Override protected Class<?> resolveClass(final ObjectStreamClass classDesc) throws ClassNotFoundException { return classLoading.loadClass(classDesc.getName()); } ObjectInputStreamWithClassLoader(final InputStream inputStream, final LoadingFunction classLoading);  ObjectInputStreamWithClassLoader(final InputStream inputStream, final ClassLoader loader);   }