Class ReturnsDeepStubs.ReturnsDeepStubsSerializationFallback

java.lang.Object
org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs
org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs.ReturnsDeepStubsSerializationFallback
All Implemented Interfaces:
Serializable, Answer<Object>
Enclosing class:
ReturnsDeepStubs

private static class ReturnsDeepStubs.ReturnsDeepStubsSerializationFallback extends ReturnsDeepStubs implements Serializable
  • Field Details

  • Constructor Details

    • ReturnsDeepStubsSerializationFallback

      public ReturnsDeepStubsSerializationFallback(GenericMetadataSupport returnTypeGenericMetadata)
  • Method Details

    • actualParameterizedType

      protected GenericMetadataSupport actualParameterizedType(Object mock)
      Overrides:
      actualParameterizedType in class ReturnsDeepStubs
    • writeReplace

      private Object writeReplace() throws IOException
      Generics support and serialization with deep stubs don't work together.

      The issue is that GenericMetadataSupport is not serializable because the type elements inferred via reflection are not serializable. Supporting serialization would require to replace all types coming from the Java reflection with our own and still managing type equality with the JDK ones.

      Throws:
      IOException