do Throw
Sets a throwable to be thrown when the stubbed method/function is being called. E.g:
whenever { mock.someFunction() } doThrow RuntimeException()This function is an alias for Mockito's OngoingStubbing.thenThrow.
Return
OngoingStubbing object used to stub fluently. Do not create a reference to this returned object.
Parameters
to be thrown on method/function invocations.
Sets throwables to be thrown when the stubbed method/function is being called consecutively. E.g:
whenever { mock.someFunction() }.doThrow(RuntimeException(), IOException())You can specify throwables to be thrown for consecutive invocations. In that case the last throwable determines the behavior of further consecutive invocations.
This function is an alias for Mockito's OngoingStubbing.thenThrow.
Return
OngoingStubbing object used to stub fluently. Do not create a reference to this returned object.
Parameters
to be thrown on the first method/function invocation.
to be thrown on the next method/function invocations.
Sets a throwable type to be thrown when the stubbed method/function is being called. E.g:
whenever { mock.someFunction() } doThrow IllegalArgumentException::classThis function is an alias for Mockito's OngoingStubbing.thenThrow.
Return
OngoingStubbing object used to stub fluently. Do not create a reference to this returned object.
Parameters
to be thrown on the method/function invocation.
Sets throwable types to be thrown when the stubbed method is called consecutively. E.g:
whenever { mock.someFunction() }.doThrow(IllegalArgumentException::class, NullPointerException::class)You can specify throwableTypes to be thrown for consecutive invocations. In that case the last throwable type determines the behavior of further consecutive invocations.
This function is an alias for Mockito's OngoingStubbing.thenThrow.
Return
OngoingStubbing object used to stub fluently. Do not create a reference to this returned object.
Parameters
to be thrown on the first method/function invocation.
to be thrown on the next method/function invocations.
Sets a throwable to be thrown, to be applied in reverse stubbing.
Example:
doThrow(IllegalArgumentException()).whenever(mock).someMethod()This function is an alias for Mockito's Mockito.doThrow.
See examples in javadoc for Mockito class
Return
Stubber object used to stub fluently.
Parameters
to be thrown on the method/function invocation.
Sets throwables to be thrown on consecutive calls, to be applied in reverse stubbing.
Example:
doThrow(RuntimeException(), IOException()).whenever(mock).someMethod()This function is an alias for Mockito's Mockito.doThrow.
You can specify throwables to be thrown for consecutive invocations. In that case the last throwable determines the behavior of further consecutive invocations.
See examples in javadoc for Mockito class
Return
Stubber object used to stub fluently.
Parameters
to be thrown on the first method/function invocation.
to be thrown on the next method/function invocations.
Sets a throwable type to be thrown, to be applied in reverse stubbing.
Example:
doThrow(IllegalArgumentException::class).whenever(mock).someMethod()This function is an alias for Mockito's Mockito.doThrow.
See examples in javadoc for Mockito class
Return
Stubber object used to stub fluently.
Parameters
to be thrown on the method/function invocation.
Sets throwable types to be thrown on consecutive calls, to be applied in reverse stubbing.
Example:
doThrow(IllegalArgumentException::class, NullPointerException::class)
.whenever(mock)
.someMethod()This function is an alias for Mockito's Mockito.doThrow.
You can specify throwableTypes to be thrown for consecutive invocations. In that case the last throwable type determines the behavior of further consecutive invocations.
See examples in javadoc for Mockito class
Return
Stubber object used to stub fluently.
Parameters
to be thrown on the first method/function invocation.
to be thrown on the next method/function invocations.