Package org.spockframework.mock.runtime
Class MockObject
- java.lang.Object
-
- org.spockframework.mock.runtime.MockObject
-
- All Implemented Interfaces:
IMockObject
public class MockObject extends java.lang.Object implements IMockObject
-
-
Constructor Summary
Constructors Constructor Description MockObject(java.lang.String name, java.lang.Class<?> type, java.lang.Object instance, boolean verified, boolean global, IDefaultResponse defaultResponse, Specification specification)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IDefaultResponse
getDefaultResponse()
Returns the default response strategy for this mock object.java.lang.Object
getInstance()
Returns the instance of this mock object.java.lang.String
getName()
Returns the name of this mock object, ornull
if it has no name.Specification
getSpecification()
Returns the specification that this mock object is attached to.java.lang.Class<?>
getType()
Returns the declared type of this mock object.boolean
isVerified()
Tells whether this mock object supports verification of invocations.boolean
matches(java.lang.Object target, IMockInteraction interaction)
Tells whether this mock object matches the target of the specified interaction.
-
-
-
Constructor Detail
-
MockObject
public MockObject(java.lang.String name, java.lang.Class<?> type, java.lang.Object instance, boolean verified, boolean global, IDefaultResponse defaultResponse, Specification specification)
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from interface:IMockObject
Returns the name of this mock object, ornull
if it has no name.- Specified by:
getName
in interfaceIMockObject
- Returns:
- the name of this mock object, or
null
if it has no name
-
getType
public java.lang.Class<?> getType()
Description copied from interface:IMockObject
Returns the declared type of this mock object.- Specified by:
getType
in interfaceIMockObject
- Returns:
- the declared type of this mock object
-
getInstance
public java.lang.Object getInstance()
Description copied from interface:IMockObject
Returns the instance of this mock object.- Specified by:
getInstance
in interfaceIMockObject
- Returns:
- the instance of this mock object
-
isVerified
public boolean isVerified()
Description copied from interface:IMockObject
Tells whether this mock object supports verification of invocations.- Specified by:
isVerified
in interfaceIMockObject
- Returns:
- whether this mock object supports verification of invocations
-
getDefaultResponse
public IDefaultResponse getDefaultResponse()
Description copied from interface:IMockObject
Returns the default response strategy for this mock object.- Specified by:
getDefaultResponse
in interfaceIMockObject
- Returns:
- the default response strategy for this mock object
-
getSpecification
public Specification getSpecification()
Description copied from interface:IMockObject
Returns the specification that this mock object is attached to.- Specified by:
getSpecification
in interfaceIMockObject
- Returns:
- the specification that this mock object is attached to
-
matches
public boolean matches(java.lang.Object target, IMockInteraction interaction)
Description copied from interface:IMockObject
Tells whether this mock object matches the target of the specified interaction.- Specified by:
matches
in interfaceIMockObject
- Parameters:
target
- the target of the interactioninteraction
- an interaction- Returns:
- whether this mock object matches the target of the specified interaction
-
-