java.lang.Object | |
↳ | com.atlassian.jira.mock.Strict<T> |
Mockito mocks are lenient by default, and this makes them throw an exception for
anything that was not expressly stubbed. Note that this means the
when(mock.method())
style of stubbing will not work because the
mock.method()
call will throw an exception instead of returning
null
. You will need to use the doReturn(null).when(mock).method()
style of stubbing, instead.
NullPointerException
when the unstubbed method is invoked? Because this will actually tell you what
the unexpected invocation was. Much more helpful!
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Throws an exception that reports the unexpected method invocation.
| |||||||||||
Factory method that will infer the correct type from the supplied class
| |||||||||||
Factory method that will infer the correct type from the context
|
[Expand]
Inherited Methods | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object | |||||||||||||
From interface
org.mockito.stubbing.Answer
|
Throws an exception that reports the unexpected method invocation.
invocationOnMock | the invocation that reached us |
---|
AssertionFailedError | reporting the invocation |
---|---|
Throwable |
Factory method that will infer the correct type from the supplied class