public class CreationSettings<T> extends java.lang.Object implements MockCreationSettings<T>, java.io.Serializable
Modifier and Type | Field and Description |
---|---|
private java.lang.Object[] |
constructorArgs |
protected Answer<java.lang.Object> |
defaultAnswer |
protected java.util.Set<java.lang.Class<?>> |
extraInterfaces |
protected java.util.List<InvocationListener> |
invocationListeners |
protected boolean |
lenient |
protected MockName |
mockName |
protected java.lang.String |
name |
private java.lang.Object |
outerClassInstance |
protected SerializableMode |
serializableMode |
private static long |
serialVersionUID |
protected java.lang.Object |
spiedInstance |
protected boolean |
stripAnnotations |
protected java.util.List<StubbingLookupListener> |
stubbingLookupListeners |
protected boolean |
stubOnly |
protected java.lang.Class<T> |
typeToMock |
private boolean |
useConstructor |
protected java.util.List<VerificationStartedListener> |
verificationStartedListeners |
Constructor and Description |
---|
CreationSettings() |
CreationSettings(CreationSettings copy) |
Modifier and Type | Method and Description |
---|---|
java.lang.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<java.lang.Object> |
getDefaultAnswer()
the default answer for this mock, see
MockSettings.defaultAnswer(org.mockito.stubbing.Answer) . |
java.util.Set<java.lang.Class<?>> |
getExtraInterfaces()
the extra interfaces the mock object should implement.
|
java.util.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) . |
java.lang.String |
getName() |
java.lang.Object |
getOuterClassInstance()
Used when mocking non-static inner classes in conjunction with
MockCreationSettings.isUsingConstructor() |
SerializableMode |
getSerializableMode() |
java.lang.Object |
getSpiedInstance()
the spied instance - needed for spies.
|
java.util.List<StubbingLookupListener> |
getStubbingLookupListeners() |
java.lang.Class<T> |
getTypeToMock()
Mocked type.
|
java.util.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(java.util.Set<java.lang.Class<?>> extraInterfaces) |
CreationSettings<T> |
setMockName(MockName mockName) |
CreationSettings<T> |
setSerializableMode(SerializableMode serializableMode) |
CreationSettings<T> |
setTypeToMock(java.lang.Class<T> typeToMock) |
private static final long serialVersionUID
protected java.lang.Class<T> typeToMock
protected java.util.Set<java.lang.Class<?>> extraInterfaces
protected java.lang.String name
protected java.lang.Object spiedInstance
protected Answer<java.lang.Object> defaultAnswer
protected MockName mockName
protected SerializableMode serializableMode
protected java.util.List<InvocationListener> invocationListeners
protected final java.util.List<StubbingLookupListener> stubbingLookupListeners
protected java.util.List<VerificationStartedListener> verificationStartedListeners
protected boolean stubOnly
protected boolean stripAnnotations
private boolean useConstructor
private java.lang.Object outerClassInstance
private java.lang.Object[] constructorArgs
protected boolean lenient
public CreationSettings()
public CreationSettings(CreationSettings copy)
public java.lang.Class<T> getTypeToMock()
MockCreationSettings
getTypeToMock
in interface MockCreationSettings<T>
public CreationSettings<T> setTypeToMock(java.lang.Class<T> typeToMock)
public java.util.Set<java.lang.Class<?>> getExtraInterfaces()
MockCreationSettings
getExtraInterfaces
in interface MockCreationSettings<T>
public CreationSettings<T> setExtraInterfaces(java.util.Set<java.lang.Class<?>> extraInterfaces)
public java.lang.String getName()
public java.lang.Object getSpiedInstance()
MockCreationSettings
getSpiedInstance
in interface MockCreationSettings<T>
public Answer<java.lang.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 java.util.List<InvocationListener> getInvocationListeners()
MockCreationSettings
InvocationListener
instances attached to this mock, see MockSettings.invocationListeners(org.mockito.listeners.InvocationListener...)
.getInvocationListeners
in interface MockCreationSettings<T>
public java.util.List<VerificationStartedListener> getVerificationStartedListeners()
MockCreationSettings
VerificationStartedListener
instances attached to this mock,
see MockSettings.verificationStartedListeners(VerificationStartedListener...)
getVerificationStartedListeners
in interface MockCreationSettings<T>
public java.util.List<StubbingLookupListener> getStubbingLookupListeners()
public boolean isUsingConstructor()
MockCreationSettings
isUsingConstructor
in interface MockCreationSettings<T>
public boolean isStripAnnotations()
MockCreationSettings
isStripAnnotations
in interface MockCreationSettings<T>
public java.lang.Object[] getConstructorArgs()
MockCreationSettings
getConstructorArgs
in interface MockCreationSettings<T>
MockCreationSettings.getOuterClassInstance()
is available, it is prepended to the passed arguments.public java.lang.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>