public 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: |
MockClassLoader(String[] classesToMock,
String[] packagesToDefer,
UseClassPathAdjuster useClassPathAdjuster)
Creates a new instance of the
MockClassLoader based on the
following parameters: |
MockClassLoader(String[] classesToMock,
UseClassPathAdjuster useClassPathAdjuster)
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, cache, findResource, findResources, getResource, getResourceAsStream, getResources, loadClass, shouldDefer, shouldIgnore, shouldIgnore, shouldModifyaddTranslator, delegateLoadingOf, delegateToParent, findClass, loadClassByDelegation, main, run, run, setClassPool, setDomainclearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSignerspublic static final String MODIFY_ALL_CLASSES
public MockClassLoader(String[] classesToMock, String[] packagesToDefer, UseClassPathAdjuster useClassPathAdjuster)
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, 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, UseClassPathAdjuster useClassPathAdjuster)
MockClassLoader based on the
following parameters:classesToMock - The classes that must be modified to prepare for testability.public MockClassLoader(String[] classesToMock)
MockClassLoader based on the
following parameters:classesToMock - The classes that must be modified to prepare for testability.public final void addClassesToModify(String... classes)
packagesToBeDeferred will be ignored. How ever
classes added here have precedence over additionally deferred (ignored)
packages (those ignored by the user using @PrepareForTest).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–2015. All rights reserved.