Package org.jmock.api
Interface Imposteriser
-
- All Known Implementing Classes:
ByteBuddyClassImposteriser
,ClassImposteriser
,JavaReflectionImposteriser
public interface Imposteriser
An object that can creates a proxy of the given type to captureInvocation
s and pass them to anInvokable
object for mocking or stubbing.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method 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 forwardsInvocation
s to anInvokable
object.
-
-
-
Method Detail
-
canImposterise
boolean canImposterise(java.lang.Class<?> type)
Reports if the Imposteriser is able to imposterise a given type.- Parameters:
type
- The type in question.- Returns:
- True if this imposteriser can imposterise type, false otherwise.
-
imposterise
<T> T imposterise(Invokable mockObject, java.lang.Class<T> mockedType, java.lang.Class<?>... ancilliaryTypes)
Creates an imposter for a given type that forwardsInvocation
s to anInvokable
object.- Type Parameters:
T
- The static type of the imposter that is created.- Parameters:
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.- Returns:
- A new imposter. The imposter must implement the mockedType and all the ancialliaryTypes.
-
-