Package org.spockframework.mock.runtime
Class MockObject
java.lang.Object
org.spockframework.mock.runtime.MockObject
- All Implemented Interfaces:
IMockObject
-
Constructor Summary
ConstructorsConstructorDescriptionMockObject(String name, Type type, Object instance, boolean verified, boolean global, IDefaultResponse defaultResponse, Specification specification) -
Method Summary
Modifier and TypeMethodDescriptionReturns the default response strategy for this mock object.Returns the exact declared type of this mock object.Returns the instance of this mock object.getName()Returns the name of this mock object, ornullif it has no name.Returns the specification that this mock object is attached to.Class<?> getType()Returns the declared type of this mock object.booleanTells whether this mock object supports verification of invocations.booleanmatches(Object target, IMockInteraction interaction) Tells whether this mock object matches the target of the specified interaction.
-
Constructor Details
-
MockObject
public MockObject(String name, Type type, Object instance, boolean verified, boolean global, IDefaultResponse defaultResponse, Specification specification)
-
-
Method Details
-
getName
Description copied from interface:IMockObjectReturns the name of this mock object, ornullif it has no name.- Specified by:
getNamein interfaceIMockObject- Returns:
- the name of this mock object, or
nullif it has no name
-
getType
Description copied from interface:IMockObjectReturns the declared type of this mock object.- Specified by:
getTypein interfaceIMockObject- Returns:
- the declared type of this mock object
-
getExactType
Description copied from interface:IMockObjectReturns the exact declared type of this mock object. The returnedTypeis either aClassor aParameterizedType.- Specified by:
getExactTypein interfaceIMockObject- Returns:
- the exact declared type of this mock object
-
getInstance
Description copied from interface:IMockObjectReturns the instance of this mock object.- Specified by:
getInstancein interfaceIMockObject- Returns:
- the instance of this mock object
-
isVerified
public boolean isVerified()Description copied from interface:IMockObjectTells whether this mock object supports verification of invocations.- Specified by:
isVerifiedin interfaceIMockObject- Returns:
- whether this mock object supports verification of invocations
-
getDefaultResponse
Description copied from interface:IMockObjectReturns the default response strategy for this mock object.- Specified by:
getDefaultResponsein interfaceIMockObject- Returns:
- the default response strategy for this mock object
-
getSpecification
Description copied from interface:IMockObjectReturns the specification that this mock object is attached to.- Specified by:
getSpecificationin interfaceIMockObject- Returns:
- the specification that this mock object is attached to
-
matches
Description copied from interface:IMockObjectTells whether this mock object matches the target of the specified interaction.- Specified by:
matchesin interfaceIMockObject- Parameters:
target- the target of the interactioninteraction- an interaction- Returns:
- whether this mock object matches the target of the specified interaction
-