@Test(expected = IllegalStateException.class) public void testInjectionException() throws Exception { InjectionClassLoader classLoader = mock(InjectionClassLoader.class); TypeDescription typeDescription = mock(TypeDescription.class); byte[] binaryRepresentation = new byte[0]; when(typeDescription.getName()).thenReturn(FOO); when(classLoader.defineClasses(Collections.singletonMap(FOO, binaryRepresentation))).thenThrow(new ClassNotFoundException(FOO)); InjectionClassLoader.Strategy.INSTANCE.load(classLoader, Collections.singletonMap(typeDescription, binaryRepresentation)); }
public Map<String, Class<?>> defineClasses(Map<String, byte[]> typeDefinitions) throws ClassNotFoundException { if (sealed) { throw new IllegalStateException("Cannot inject classes into a sealed class loader"); } return doDefineClasses(typeDefinitions); }
InjectionClassLoader extends ClassLoader { public Map<String, Class<?>> defineClasses(Map<String, byte[]> typeDefinitions) throws ClassNotFoundException { if (sealed) { throw new IllegalStateException("Cannot inject classes into a sealed class loader"); } return doDefineClasses(typeDefinitions); } }
InjectionClassLoader extends ClassLoader { public Map<String, Class<?>> defineClasses(Map<String, byte[]> typeDefinitions) throws ClassNotFoundException { if (sealed) { throw new IllegalStateException("Cannot inject classes into a sealed class loader"); } return doDefineClasses(typeDefinitions); } protected  InjectionClassLoader(ClassLoader parent, boolean sealed); }
InjectionClassLoader extends ClassLoader { public Map<String, Class<?>> defineClasses(Map<String, byte[]> typeDefinitions) throws ClassNotFoundException { if (sealed) { throw new IllegalStateException("Cannot inject classes into a sealed class loader"); } return doDefineClasses(typeDefinitions); } protected  InjectionClassLoader(ClassLoader parent, boolean sealed); boolean isSealed(); Class<?> defineClass(String name, byte[] binaryRepresentation); Map<String, Class<?>> defineClasses(Map<String, byte[]> typeDefinitions); }
InjectionClassLoader extends ClassLoader { public Map<String, Class<?>> defineClasses(Map<String, byte[]> typeDefinitions) throws ClassNotFoundException { if (sealed) { throw new IllegalStateException("Cannot inject classes into a sealed class loader"); } return doDefineClasses(typeDefinitions); } protected  InjectionClassLoader(ClassLoader parent, boolean sealed); boolean isSealed(); Class<?> defineClass(String name, byte[] binaryRepresentation); Map<String, Class<?>> defineClasses(Map<String, byte[]> typeDefinitions);  }