public final class MockClassLoader extends DeferSupportingClassLoader
| Modifier and Type | Field and Description |
|---|---|
static String |
MODIFY_ALL_CLASSES
Pass this string to the constructor to indicate that all classes should
be modified.
|
| Constructor and Description |
|---|
MockClassLoader(String[] classesToMock)
Creates a new instance of the
MockClassLoader based on the
following parameters: |
MockClassLoader(String[] classesToMock,
String[] packagesToDefer)
Creates a new instance of the
MockClassLoader based on the
following parameters: |
| Modifier and Type | Method and Description |
|---|---|
void |
addClassesToModify(String... classes)
Add classes that will be loaded by the mock classloader, i.e.
|
protected Class<?> |
loadModifiedClass(String s) |
void |
setMockTransformerChain(List<MockTransformer> mockTransformerChain) |
protected boolean |
shouldLoadUnmodifiedClass(String className) |
boolean |
shouldModifyAll() |
protected boolean |
shouldModifyClass(String s) |
addIgnorePackage, findResource, findResources, loadClass, shouldDefer, shouldIgnore, shouldIgnore, shouldModifyclearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSignerspublic static final String MODIFY_ALL_CLASSES
public MockClassLoader(String[] classesToMock, String[] packagesToDefer)
MockClassLoader based on the
following parameters:classesToMock - The classes that must be modified to prepare for testability.packagesToDefer - Classes in these packages will be defered to the system
class-loader.public MockClassLoader(String[] classesToMock)
MockClassLoader based on the
following parameters:classesToMock - The classes that must be modified to prepare for testability.public void addClassesToModify(String... classes)
packagesToBeDeferred will be ignored.classes - The fully qualified name of the classes that will be appended
to the list of classes that will be byte-code modified to
enable testability.protected Class<?> loadModifiedClass(String s) throws ClassFormatError, ClassNotFoundException
loadModifiedClass in class DeferSupportingClassLoaderClassFormatErrorClassNotFoundExceptionpublic boolean shouldModifyAll()
public void setMockTransformerChain(List<MockTransformer> mockTransformerChain)
protected boolean shouldModifyClass(String s)
shouldModifyClass in class DeferSupportingClassLoaderprotected boolean shouldLoadUnmodifiedClass(String className)
shouldLoadUnmodifiedClass in class DeferSupportingClassLoaderCopyright © 2007–2014. All rights reserved.