mockito-kotlin / com.nhaarman.mockitokotlin2 / withSettings

withSettings

fun withSettings(extraInterfaces: Array<KClass<out Any>>? = null, name: String? = null, spiedInstance: Any? = null, defaultAnswer: Answer<Any>? = null, serializable: Boolean = false, serializableMode: SerializableMode? = null, verboseLogging: Boolean = false, invocationListeners: Array<InvocationListener>? = null, stubOnly: Boolean = false, @Incubating useConstructor: UseConstructor? = null, @Incubating outerInstance: Any? = null): MockSettings

Allows mock creation with additional mock settings. See MockSettings.

Parameters

extraInterfaces - Specifies extra interfaces the mock should implement.

name - Specifies mock name. Naming mocks can be helpful for debugging - the name is used in all verification errors.

spiedInstance - Specifies the instance to spy on. Makes sense only for spies/partial mocks.

defaultAnswer - Specifies default answers to interactions.

serializable - Configures the mock to be serializable.

serializableMode - Configures the mock to be serializable with a specific serializable mode.

verboseLogging - Enables real-time logging of method invocations on this mock.

invocationListeners - Registers a listener for method invocations on this mock. The listener is notified every time a method on this mock is called.

stubOnly - A stub-only mock does not record method invocations, thus saving memory but disallowing verification of invocations.

useConstructor - Mockito attempts to use constructor when creating instance of the mock.

outerInstance - Makes it possible to mock non-static inner classes in conjunction with useConstructor.