### Question:
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; }### Answer:
@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); }
@Test public void should_load_and_not_modify_class_from_package_which_are_not_specified_as_ignored_or_class_to_mock() throws Exception { String className = "powermock.test.support.ClassForMockClassLoaderTestCase"; MockClassLoader mockClassLoader = mockClassLoaderFactory.getInstance(new String[0]); mockClassLoader.setMockTransformerChain(mockTransformerChain); Class<?> clazz = Class.forName(className, false, mockClassLoader); assertClassIsLoaded(clazz, mockClassLoader); assertThatInstanceCouldBeCreateAndMethodReturnNotMockedValue(clazz); }