Class MockClassLoaderConfiguration
java.lang.Object
org.powermock.core.classloader.MockClassLoaderConfiguration
The instance of the class provides information about classes which have to be mocked, loaded without modification
or defer to system class loader.
-
Constructor Summary
ConstructorsConstructorDescriptionCreate an instance of configuration without any classes to mock or ignore.MockClassLoaderConfiguration(String[] classesToMock, String[] packagesToDefer) Create an instance of configuration -
Method Summary
Modifier and TypeMethodDescriptionfinal voidaddClassesToModify(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.voidaddIgnorePackage(String... packagesToIgnore) Add packages or classes to ignore.
-
Constructor Details
-
MockClassLoaderConfiguration
public MockClassLoaderConfiguration()Create an instance of configuration without any classes to mock or ignore. -
MockClassLoaderConfiguration
Create an instance of configuration- Parameters:
classesToMock- classes that should be modified byMockClassLoader.packagesToDefer- classes/packages that should be deferred to system class loader.
-
-
Method Details
-
addIgnorePackage
Add packages or classes to ignore. Loading of all classes that locate in the added packages will be delegate to a system classloader.Package should be specified with using mask. Example:
configuration.addIgnorePackage("org.powermock.example.*");- Parameters:
packagesToIgnore- fully qualified names of classes or names of packages that end by.*
-
addClassesToModify
Add classes that will be loaded by the mock classloader, i.e. these classes will be byte-code manipulated to allow for testing. Any classes contained in thePACKAGES_TO_BE_DEFERREDwill be ignored. How ever classes added here have precedence over additionally deferred (ignored) packages (those ignored by the user using @PrepareForTest).- Parameters:
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.
-