Package | Description |
---|---|
org.mockito |
Mockito is a mock library for java - see Mockito class for for usage.
|
org.mockito.configuration |
Mockito configuration utilities
|
org.mockito.internal.configuration |
Mockito configuration
|
org.mockito.internal.stubbing.answers |
Answers for stubbed calls
|
Modifier and Type | Method and Description |
---|---|
static <T> T |
Mockito.mock(Class<T> classToMock,
ReturnValues returnValues)
Deprecated.
Please use mock(Foo.class, defaultAnswer);
See Why it is deprecated? ReturnValues is being replaced by Answer for better consistency & interoperability of the framework. Answer interface has been in Mockito for a while and it has the same responsibility as ReturnValues. There's no point in mainting exactly the same interfaces. Creates mock with a specified strategy for its return values. It's quite advanced feature and typically you don't need it to write decent tests. However it can be helpful when working with legacy systems. Obviously return values are used only when you don't stub the method call. Foo mock = mock(Foo.class, Mockito.RETURNS_SMART_NULLS); Foo mockTwo = mock(Foo.class, new YourOwnReturnValues()); See examples in javadoc for |
Modifier and Type | Method and Description |
---|---|
ReturnValues |
IMockitoConfiguration.getReturnValues()
Deprecated.
Please use
IMockitoConfiguration.getDefaultAnswer()
Steps: 1. Leave the implementation of getReturnValues() method empty - it's not going to be used anyway. 2. Implement getDefaultAnswer() instead. In rare cases your code might not compile with recent deprecation & changes. Very sorry for inconvenience but it had to be done in order to keep framework consistent.
See javadoc Allows configuring the default return values of unstubbed invocations
See javadoc for |
ReturnValues |
DefaultMockitoConfiguration.getReturnValues()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
ReturnValues |
GlobalConfiguration.getReturnValues() |
Constructor and Description |
---|
AnswerReturnValuesAdapter(ReturnValues returnValues) |
Copyright © 2018. All rights reserved.