@Test public void should_load_and_modify_class_from_package_which_specified() throws Exception { String className = "powermock.test.support.ClassForMockClassLoaderTestCase"; MockClassLoader mockClassLoader = mockClassLoaderFactory.getInstance(new String[]{ className }); mockClassLoader.setMockTransformerChain(mockTransformerChain); Class<?> clazz = Class.forName(className, false, mockClassLoader); assertClassIsLoaded(clazz, mockClassLoader); assertThatInstanceCouldBeCreateAndMethodReturnMockedValue(clazz); }
public void setMockTransformerChain(MockTransformerChain mockTransformerChain) { this.mockTransformerChain = mockTransformerChain; }
MockClassLoader extends DeferSupportingClassLoader { public void setMockTransformerChain(MockTransformerChain mockTransformerChain) { this.mockTransformerChain = mockTransformerChain; } }
MockClassLoader extends DeferSupportingClassLoader { public void setMockTransformerChain(MockTransformerChain mockTransformerChain) { this.mockTransformerChain = mockTransformerChain; } protected  MockClassLoader(String[] classesToMock, String[] packagesToDefer); protected  MockClassLoader(MockClassLoaderConfiguration configuration, final ClassWrapperFactory classWrapperFactory); }
MockClassLoader extends DeferSupportingClassLoader { public void setMockTransformerChain(MockTransformerChain mockTransformerChain) { this.mockTransformerChain = mockTransformerChain; } protected  MockClassLoader(String[] classesToMock, String[] packagesToDefer); protected  MockClassLoader(MockClassLoaderConfiguration configuration, final ClassWrapperFactory classWrapperFactory); void setMockTransformerChain(MockTransformerChain mockTransformerChain); MockTransformerChain getMockTransformerChain(); Class<?> defineClass(final String name, final ProtectionDomain protectionDomain, final byte[] clazz); }
MockClassLoader extends DeferSupportingClassLoader { public void setMockTransformerChain(MockTransformerChain mockTransformerChain) { this.mockTransformerChain = mockTransformerChain; } protected  MockClassLoader(String[] classesToMock, String[] packagesToDefer); protected  MockClassLoader(MockClassLoaderConfiguration configuration, final ClassWrapperFactory classWrapperFactory); void setMockTransformerChain(MockTransformerChain mockTransformerChain); MockTransformerChain getMockTransformerChain(); Class<?> defineClass(final String name, final ProtectionDomain protectionDomain, final byte[] clazz); static final String MODIFY_ALL_CLASSES; }