ReturnsDeepStubs
Date: 2015-09-18

org.mockito.internal.stubbing.defaultanswers

## Class ReturnsDeepStubs

- java.lang.Object
- - org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs

- All Implemented Interfaces:
    java.io.Serializable, Answer<java.lang.Object>

      public class ReturnsDeepStubs
      extends java.lang.Object
      implements Answer<java.lang.Object>, java.io.Serializable

  Returning deep stub implementation. Will return previously created mock if the invocation matches.

  Supports nested generic information, with this answer you can write code like this :

           interface GenericsNest<K extends Comparable<K> & Cloneable> extends Map<K, Set<Number>> {}

           GenericsNest<?> mock = mock(GenericsNest.class, new ReturnsGenericDeepStubs());
           Number number = mock.entrySet().iterator().next().getValue().iterator().next();

  See Also:
    `Mockito.RETURNS_DEEP_STUBS`, `Answers.RETURNS_DEEP_STUBS`, Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ReturnsDeepStubs()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected GenericMetadataSupport` | `actualParameterizedType(java.lang.Object mock)`
    `java.lang.Object` | `answer(InvocationOnMock invocation)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ReturnsDeepStubs

          public ReturnsDeepStubs()

  - ### Method Detail

    - #### answer

          public java.lang.Object answer(InvocationOnMock invocation)
                                  throws java.lang.Throwable

      Specified by:
        `answer` in interface `Answer<java.lang.Object>`
      Parameters:
        `invocation` - the invocation on the mock.
      Returns:
        the value to be returned
      Throws:
        `java.lang.Throwable` - the throwable to be thrown

    - #### actualParameterizedType

          protected GenericMetadataSupport actualParameterizedType(java.lang.Object mock)