Class ClassReplicaCreator
java.lang.Object
org.powermock.core.ClassReplicaCreator
This class takes care of creating a replica of a class. The class structure
is copied to the new class. This is useful in situations where you want to
create a mock for a class but it's not possible because of some restrictions
(such as the class being loaded by the bootstrap class-loader).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> Class<T> createClassReplica(Class<T> clazz) <T> Class<T> createInstanceReplica(T delegator) Create a class that is a replica of typeT.
-
Constructor Details
-
ClassReplicaCreator
public ClassReplicaCreator()
-
-
Method Details
-
createClassReplica
-
createInstanceReplica
Create a class that is a replica of typeT. To allow for partial mocking all calls to non-mocked methods will be delegated to thedelegator.- Type Parameters:
T- The type of the replica class to be created.- Parameters:
delegator- The delegator object that will be invoked to allow for partial mocking.- Returns:
- A replica class that can be used to duck-type an instance.
-