public class JavaReflectionImposteriser extends 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(Class<?> type)
Reports if the Imposteriser is able to imposterise a given type.
|
<T> T |
imposterise(Invokable mockObject,
Class<T> mockedType,
Class<?>... ancilliaryTypes)
Creates an imposter for a given type that forwards
Invocation s to an
Invokable object. |
public static final Imposteriser INSTANCE
public boolean canImposterise(Class<?> type)
Imposteriser
canImposterise
in interface Imposteriser
type
- The type in question.public <T> T imposterise(Invokable mockObject, Class<T> mockedType, Class<?>... ancilliaryTypes)
Imposteriser
Invocation
s to an
Invokable
object.imposterise
in interface Imposteriser
T
- 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.Copyright © 2003–2018 jMock. All rights reserved.