Class CreationSettings<T>
java.lang.Object
org.mockito.internal.creation.settings.CreationSettings<T>
- All Implemented Interfaces:
Serializable
,MockCreationSettings<T>
- Direct Known Subclasses:
MockSettingsImpl
by Szczepan Faber, created at: 4/9/12
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<InvocationListener>
protected MockName
protected String
protected SerializableMode
protected Object
protected boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionthe default answer for this mock, seeMockSettings.defaultAnswer(org.mockito.stubbing.Answer)
.the extra interfaces the mock object should implement.The invocation listeners attached to this mock, seeMockSettings.invocationListeners(org.mockito.listeners.InvocationListener...)
.the name of this mock, as printed on verification errors; seeMockSettings.name(java.lang.String)
.getName()
Used when mocking non-static inner classes in conjunction withMockCreationSettings.isUsingConstructor()
the spied instance - needed for spies.Mocked type.boolean
if the mock is serializable, seeMockSettings.serializable()
.boolean
Whether the mock is only for stubbing, i.e.boolean
Informs whether the mock instance should be created via constructorsetExtraInterfaces
(Set<Class> extraInterfaces) setMockName
(MockName mockName) setTypeToMock
(Class<T> typeToMock)
-
Field Details
-
typeToMock
-
extraInterfaces
-
name
-
spiedInstance
-
defaultAnswer
-
mockName
-
serializableMode
-
invocationListeners
-
stubOnly
protected boolean stubOnly
-
-
Constructor Details
-
CreationSettings
public CreationSettings() -
CreationSettings
-
-
Method Details
-
getTypeToMock
Description copied from interface:MockCreationSettings
Mocked type. An interface or class the mock should implement / extend.- Specified by:
getTypeToMock
in interfaceMockCreationSettings<T>
-
setTypeToMock
-
getExtraInterfaces
Description copied from interface:MockCreationSettings
the extra interfaces the mock object should implement.- Specified by:
getExtraInterfaces
in interfaceMockCreationSettings<T>
-
setExtraInterfaces
-
getName
-
getSpiedInstance
Description copied from interface:MockCreationSettings
the spied instance - needed for spies.- Specified by:
getSpiedInstance
in interfaceMockCreationSettings<T>
-
getDefaultAnswer
Description copied from interface:MockCreationSettings
the default answer for this mock, seeMockSettings.defaultAnswer(org.mockito.stubbing.Answer)
.- Specified by:
getDefaultAnswer
in interfaceMockCreationSettings<T>
-
getMockName
Description copied from interface:MockCreationSettings
the name of this mock, as printed on verification errors; seeMockSettings.name(java.lang.String)
.- Specified by:
getMockName
in interfaceMockCreationSettings<T>
-
setMockName
-
isSerializable
public boolean isSerializable()Description copied from interface:MockCreationSettings
if the mock is serializable, seeMockSettings.serializable()
.- Specified by:
isSerializable
in interfaceMockCreationSettings<T>
-
getSerializableMode
- Specified by:
getSerializableMode
in interfaceMockCreationSettings<T>
- Returns:
- the serializable mode of this mock
-
getInvocationListeners
Description copied from interface:MockCreationSettings
The invocation listeners attached to this mock, seeMockSettings.invocationListeners(org.mockito.listeners.InvocationListener...)
.- Specified by:
getInvocationListeners
in interfaceMockCreationSettings<T>
-
isUsingConstructor
public boolean isUsingConstructor()Description copied from interface:MockCreationSettings
Informs whether the mock instance should be created via constructor- Specified by:
isUsingConstructor
in interfaceMockCreationSettings<T>
-
getOuterClassInstance
Description copied from interface:MockCreationSettings
Used when mocking non-static inner classes in conjunction withMockCreationSettings.isUsingConstructor()
- Specified by:
getOuterClassInstance
in interfaceMockCreationSettings<T>
- Returns:
- the outer class instance used for creation of the mock object via the constructor.
-
isStubOnly
public boolean isStubOnly()Description copied from interface:MockCreationSettings
Whether the mock is only for stubbing, i.e. does not remember parameters on its invocation and therefore cannot be used for verification- Specified by:
isStubOnly
in interfaceMockCreationSettings<T>
-