Package org.spockframework.mock.runtime
Class MockConfiguration
java.lang.Object
org.spockframework.mock.runtime.MockConfiguration
- All Implemented Interfaces:
IMockConfiguration
-
Constructor Summary
ConstructorsConstructorDescriptionMockConfiguration(String name, Type type, MockNature nature, MockImplementation implementation, Map<String, Object> options) -
Method Summary
Modifier and TypeMethodDescriptionReturns the constructor arguments to be used for creating the mock object.Returns the default response strategy for the mock object.Returns the exact interface or class type of the mock object.Returns the implementation of the mock object.getName()Returns the name of the mock object.Returns the nature of the mock object.Class<?> getType()Returns the interface or class type of the mock object.booleanisGlobal()Tells whether a mock object stands in for all objects of the mocked type, or just for itself.booleanTells whether the Objenesis library, if available on the class path, should be used for constructing the mock object, rather than calling a constructor.booleanTells whether invocations on the mock object should be verified.
-
Constructor Details
-
MockConfiguration
public MockConfiguration(String name, Type type, MockNature nature, MockImplementation implementation, Map<String, Object> options)
-
-
Method Details
-
getName
Description copied from interface:IMockConfigurationReturns the name of the mock object.- Specified by:
getNamein interfaceIMockConfiguration- Returns:
- the name of the mock object
-
getType
Description copied from interface:IMockConfigurationReturns the interface or class type of the mock object.- Specified by:
getTypein interfaceIMockConfiguration- Returns:
- the interface or class type of the mock object
-
getExactType
Description copied from interface:IMockConfigurationReturns the exact interface or class type of the mock object. The returnedTypeis either aClassor aParameterizedType.- Specified by:
getExactTypein interfaceIMockConfiguration- Returns:
- the exact interface or class type of the mock object
-
getNature
Description copied from interface:IMockConfigurationReturns the nature of the mock object. A nature is a named set of defaults for mock configuration options.- Specified by:
getNaturein interfaceIMockConfiguration- Returns:
- the nature of the mock object
-
getImplementation
Description copied from interface:IMockConfigurationReturns the implementation of the mock object.- Specified by:
getImplementationin interfaceIMockConfiguration- Returns:
- the implementation of the mock object
-
getConstructorArgs
Description copied from interface:IMockConfigurationReturns the constructor arguments to be used for creating the mock object.- Specified by:
getConstructorArgsin interfaceIMockConfiguration- Returns:
- the constructor arguments to be used for creating the mock object
-
getDefaultResponse
Description copied from interface:IMockConfigurationReturns the default response strategy for the mock object.- Specified by:
getDefaultResponsein interfaceIMockConfiguration- Returns:
- the default response strategy for the mock object
-
isGlobal
public boolean isGlobal()Description copied from interface:IMockConfigurationTells whether a mock object stands in for all objects of the mocked type, or just for itself. This is an optional feature that may not be supported by a particularMockImplementation.- Specified by:
isGlobalin interfaceIMockConfiguration- Returns:
- whether a mock object stands in for all objects of the mocked type, or just for itself
-
isVerified
public boolean isVerified()Description copied from interface:IMockConfigurationTells whether invocations on the mock object should be verified. If (@code false}, invocations on the mock object will not be matched against interactions that have a cardinality.- Specified by:
isVerifiedin interfaceIMockConfiguration- Returns:
- whether invocations on the mock object should be verified
-
isUseObjenesis
public boolean isUseObjenesis()Description copied from interface:IMockConfigurationTells whether the Objenesis library, if available on the class path, should be used for constructing the mock object, rather than calling a constructor.- Specified by:
isUseObjenesisin interfaceIMockConfiguration- Returns:
- whether the Objenesis library should be used for constructing the mock object
-