|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.ClassLoader
org.powermock.core.classloader.DeferSupportingClassLoader
org.powermock.core.classloader.MockClassLoader
public final class MockClassLoader
Mock all classes except system classes. Notice that there are two different types of classes that are not mocked:
| Field Summary | |
|---|---|
static java.lang.String |
MODIFY_ALL_CLASSES
Pass this string to the constructor to indicate that all classes should be modified. |
| Constructor Summary | |
|---|---|
MockClassLoader(java.lang.String[] classesToMock)
Creates a new instance of the MockClassLoader based on the
following parameters: |
|
MockClassLoader(java.lang.String[] classesToMock,
java.lang.String[] packagesToDefer)
Creates a new instance of the MockClassLoader based on the
following parameters: |
|
| Method Summary | |
|---|---|
void |
addClassesToModify(java.lang.String... classes)
Add classes that will be loaded by the mock classloader, i.e. these classes will be byte-code manipulated to allow for testing. |
protected java.lang.Class<?> |
loadModifiedClass(java.lang.String s)
|
void |
setMockTransformerChain(java.util.List<MockTransformer> mockTransformerChain)
|
protected boolean |
shouldLoadUnmodifiedClass(java.lang.String className)
|
boolean |
shouldModifyAll()
|
protected boolean |
shouldModifyClass(java.lang.String s)
|
| Methods inherited from class org.powermock.core.classloader.DeferSupportingClassLoader |
|---|
addIgnorePackage, findResource, findResources, loadClass, shouldDefer, shouldIgnore, shouldIgnore, shouldModify |
| Methods inherited from class java.lang.ClassLoader |
|---|
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String MODIFY_ALL_CLASSES
| Constructor Detail |
|---|
public MockClassLoader(java.lang.String[] classesToMock,
java.lang.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(java.lang.String[] classesToMock)
MockClassLoader based on the
following parameters:
classesToMock - The classes that must be modified to prepare for testability.| Method Detail |
|---|
public void addClassesToModify(java.lang.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 java.lang.Class<?> loadModifiedClass(java.lang.String s)
throws java.lang.ClassFormatError,
java.lang.ClassNotFoundException
loadModifiedClass in class DeferSupportingClassLoaderjava.lang.ClassFormatError
java.lang.ClassNotFoundExceptionpublic boolean shouldModifyAll()
public void setMockTransformerChain(java.util.List<MockTransformer> mockTransformerChain)
protected boolean shouldModifyClass(java.lang.String s)
shouldModifyClass in class DeferSupportingClassLoaderprotected boolean shouldLoadUnmodifiedClass(java.lang.String className)
shouldLoadUnmodifiedClass in class DeferSupportingClassLoader
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||