|
||||||||||
| 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 String |
MODIFY_ALL_CLASSES
Pass this string to the constructor to indicate that all classes should be modified. |
| Constructor Summary | |
|---|---|
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: |
|
| Method Summary | |
|---|---|
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)
|
| Methods inherited from class org.powermock.core.classloader.DeferSupportingClassLoader |
|---|
addIgnorePackage, findResource, findResources, getResource, getResourceAsStream, getResources, loadClass, shouldDefer, shouldIgnore, shouldIgnore, shouldModify |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String MODIFY_ALL_CLASSES
| Constructor Detail |
|---|
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.| Method Detail |
|---|
public 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 DeferSupportingClassLoaderClassFormatError
ClassNotFoundExceptionpublic boolean shouldModifyAll()
public void setMockTransformerChain(List<MockTransformer> mockTransformerChain)
protected boolean shouldModifyClass(String s)
shouldModifyClass in class DeferSupportingClassLoaderprotected boolean shouldLoadUnmodifiedClass(String className)
shouldLoadUnmodifiedClass in class DeferSupportingClassLoader
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||