public class JavaReflectionImposteriser extends java.lang.Object implements Imposteriser
Imposteriser that uses the
Proxy class of the Java Reflection API.| Modifier and Type | Field and Description |
|---|---|
static Imposteriser |
INSTANCE |
| Constructor and Description |
|---|
JavaReflectionImposteriser() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canImposterise(java.lang.Class<?> type)
Reports if the Imposteriser is able to imposterise a given type.
|
<T> T |
imposterise(Invokable mockObject,
java.lang.Class<T> mockedType,
java.lang.Class<?>... ancilliaryTypes)
Creates an imposter for a given type that forwards
Invocations to an
Invokable object. |
public static final Imposteriser INSTANCE
public boolean canImposterise(java.lang.Class<?> type)
ImposterisercanImposterise in interface Imposterisertype - The type in question.public <T> T imposterise(Invokable mockObject, java.lang.Class<T> mockedType, java.lang.Class<?>... ancilliaryTypes)
ImposteriserInvocations to an
Invokable object.imposterise in interface ImposteriserT - The static type of the imposter that is created.mockObject - The object that is to receive invocations forwarded from the imposter.mockedType - The class representing the static type of the imposter.ancilliaryTypes - Other types for the imposter. It must be possible to dynamically cast the imposter to these types.
These types must all be interfaces because Java only allows single inheritance of classes.