org.powermock.core
Class ClassReplicaCreator

java.lang.Object
  extended by org.powermock.core.ClassReplicaCreator

public class ClassReplicaCreator
extends Object

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
ClassReplicaCreator()
           
 
Method Summary
 Class<?> createClassReplica(Class<?> clazz)
           
<T> Class<T>
createInstanceReplica(T delegator)
          Create a class that is a replica of type T.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassReplicaCreator

public ClassReplicaCreator()
Method Detail

createClassReplica

public Class<?> createClassReplica(Class<?> clazz)

createInstanceReplica

public <T> Class<T> createInstanceReplica(T delegator)
Create a class that is a replica of type T. To allow for partial mocking all calls to non-mocked methods will be delegated to the delegator.

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.


Copyright © 2007-2012. All Rights Reserved.