Uses of Interface
org.mockito.ReturnValues

Packages that use ReturnValues
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 
 

Uses of ReturnValues in org.mockito
 

Methods in org.mockito with parameters of type ReturnValues
static
<T> T
Mockito.mock(java.lang.Class<T> classToMock, ReturnValues returnValues)
          Deprecated. Please use mock(Foo.class, defaultAnswer);

See Mockito.mock(Class, Answer)

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 Mockito class

 

Uses of ReturnValues in org.mockito.configuration
 

Methods in org.mockito.configuration that return ReturnValues
 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 ReturnValues for info why this method was deprecated

Allows configuring the default return values of unstubbed invocations

See javadoc for IMockitoConfiguration

 ReturnValues DefaultMockitoConfiguration.getReturnValues()
          Deprecated. 
 

Uses of ReturnValues in org.mockito.internal.configuration
 

Methods in org.mockito.internal.configuration that return ReturnValues
 ReturnValues GlobalConfiguration.getReturnValues()
           
 

Uses of ReturnValues in org.mockito.internal.stubbing.answers
 

Constructors in org.mockito.internal.stubbing.answers with parameters of type ReturnValues
AnswerReturnValuesAdapter(ReturnValues returnValues)