public class CreationSettings<T> extends Object implements MockCreationSettings<T>, Serializable
Modifier and Type | Field and Description |
---|---|
protected Answer<Object> |
defaultAnswer |
protected Set<Class<?>> |
extraInterfaces |
protected List<InvocationListener> |
invocationListeners |
protected boolean |
lenient |
protected MockName |
mockName |
protected String |
name |
protected SerializableMode |
serializableMode |
protected Object |
spiedInstance |
protected boolean |
stripAnnotations |
protected List<StubbingLookupListener> |
stubbingLookupListeners |
protected boolean |
stubOnly |
protected Class<T> |
typeToMock |
protected List<VerificationStartedListener> |
verificationStartedListeners |
Constructor and Description |
---|
CreationSettings() |
CreationSettings(CreationSettings copy) |
Modifier and Type | Method and Description |
---|---|
Object[] |
getConstructorArgs()
Used when arguments should be passed to the mocked object's constructor, regardless of whether these
arguments are supplied directly, or whether they include the outer instance.
|
Answer<Object> |
getDefaultAnswer()
the default answer for this mock, see
MockSettings.defaultAnswer(org.mockito.stubbing.Answer) . |
Set<Class<?>> |
getExtraInterfaces()
the extra interfaces the mock object should implement.
|
List<InvocationListener> |
getInvocationListeners()
InvocationListener instances attached to this mock, see MockSettings.invocationListeners(org.mockito.listeners.InvocationListener...) . |
MockName |
getMockName()
the name of this mock, as printed on verification errors; see
MockSettings.name(java.lang.String) . |
String |
getName() |
Object |
getOuterClassInstance()
Used when mocking non-static inner classes in conjunction with
MockCreationSettings.isUsingConstructor() |
SerializableMode |
getSerializableMode() |
Object |
getSpiedInstance()
the spied instance - needed for spies.
|
List<StubbingLookupListener> |
getStubbingLookupListeners() |
Class<T> |
getTypeToMock()
Mocked type.
|
List<VerificationStartedListener> |
getVerificationStartedListeners()
VerificationStartedListener instances attached to this mock,
see MockSettings.verificationStartedListeners(VerificationStartedListener...) |
boolean |
isLenient()
Informs if the mock was created with "lenient" strictness, e.g.
|
boolean |
isSerializable()
if the mock is serializable, see
MockSettings.serializable() . |
boolean |
isStripAnnotations()
Whether the mock should not make a best effort to preserve annotations.
|
boolean |
isStubOnly()
Whether the mock is only for stubbing, i.e.
|
boolean |
isUsingConstructor()
Informs whether the mock instance should be created via constructor
|
CreationSettings<T> |
setExtraInterfaces(Set<Class<?>> extraInterfaces) |
CreationSettings<T> |
setMockName(MockName mockName) |
CreationSettings<T> |
setSerializableMode(SerializableMode serializableMode) |
CreationSettings<T> |
setTypeToMock(Class<T> typeToMock) |
protected String name
protected Object spiedInstance
protected MockName mockName
protected SerializableMode serializableMode
protected List<InvocationListener> invocationListeners
protected final List<StubbingLookupListener> stubbingLookupListeners
protected List<VerificationStartedListener> verificationStartedListeners
protected boolean stubOnly
protected boolean stripAnnotations
protected boolean lenient
public CreationSettings()
public CreationSettings(CreationSettings copy)
public Class<T> getTypeToMock()
MockCreationSettings
getTypeToMock
in interface MockCreationSettings<T>
public CreationSettings<T> setTypeToMock(Class<T> typeToMock)
public Set<Class<?>> getExtraInterfaces()
MockCreationSettings
getExtraInterfaces
in interface MockCreationSettings<T>
public CreationSettings<T> setExtraInterfaces(Set<Class<?>> extraInterfaces)
public String getName()
public Object getSpiedInstance()
MockCreationSettings
getSpiedInstance
in interface MockCreationSettings<T>
public Answer<Object> getDefaultAnswer()
MockCreationSettings
MockSettings.defaultAnswer(org.mockito.stubbing.Answer)
.getDefaultAnswer
in interface MockCreationSettings<T>
public MockName getMockName()
MockCreationSettings
MockSettings.name(java.lang.String)
.getMockName
in interface MockCreationSettings<T>
public CreationSettings<T> setMockName(MockName mockName)
public boolean isSerializable()
MockCreationSettings
MockSettings.serializable()
.isSerializable
in interface MockCreationSettings<T>
public CreationSettings<T> setSerializableMode(SerializableMode serializableMode)
public SerializableMode getSerializableMode()
getSerializableMode
in interface MockCreationSettings<T>
public List<InvocationListener> getInvocationListeners()
MockCreationSettings
InvocationListener
instances attached to this mock, see MockSettings.invocationListeners(org.mockito.listeners.InvocationListener...)
.getInvocationListeners
in interface MockCreationSettings<T>
public List<VerificationStartedListener> getVerificationStartedListeners()
MockCreationSettings
VerificationStartedListener
instances attached to this mock,
see MockSettings.verificationStartedListeners(VerificationStartedListener...)
getVerificationStartedListeners
in interface MockCreationSettings<T>
public List<StubbingLookupListener> getStubbingLookupListeners()
public boolean isUsingConstructor()
MockCreationSettings
isUsingConstructor
in interface MockCreationSettings<T>
public boolean isStripAnnotations()
MockCreationSettings
isStripAnnotations
in interface MockCreationSettings<T>
public Object[] getConstructorArgs()
MockCreationSettings
getConstructorArgs
in interface MockCreationSettings<T>
MockCreationSettings.getOuterClassInstance()
is available, it is prepended to the passed arguments.public Object getOuterClassInstance()
MockCreationSettings
MockCreationSettings.isUsingConstructor()
getOuterClassInstance
in interface MockCreationSettings<T>
public boolean isStubOnly()
MockCreationSettings
isStubOnly
in interface MockCreationSettings<T>
public boolean isLenient()
MockCreationSettings
Strictness.LENIENT
characteristic.
For more information about using mocks with lenient strictness, see MockSettings.lenient()
.isLenient
in interface MockCreationSettings<T>
Copyright © 2022. All rights reserved.