Class ReturnsDeepStubs.ReturnsDeepStubsSerializationFallback
- java.lang.Object
-
- org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs
-
- org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs.ReturnsDeepStubsSerializationFallback
-
- All Implemented Interfaces:
java.io.Serializable
,Answer<java.lang.Object>
- Enclosing class:
- ReturnsDeepStubs
private static class ReturnsDeepStubs.ReturnsDeepStubsSerializationFallback extends ReturnsDeepStubs implements java.io.Serializable
-
-
Field Summary
Fields Modifier and Type Field Description private GenericMetadataSupport
returnTypeGenericMetadata
-
Constructor Summary
Constructors Constructor Description ReturnsDeepStubsSerializationFallback(GenericMetadataSupport returnTypeGenericMetadata)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected GenericMetadataSupport
actualParameterizedType(java.lang.Object mock)
private java.lang.Object
writeReplace()
Generics support and serialization with deep stubs don't work together.-
Methods inherited from class org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs
answer
-
-
-
-
Field Detail
-
returnTypeGenericMetadata
private final GenericMetadataSupport returnTypeGenericMetadata
-
-
Constructor Detail
-
ReturnsDeepStubsSerializationFallback
public ReturnsDeepStubsSerializationFallback(GenericMetadataSupport returnTypeGenericMetadata)
-
-
Method Detail
-
actualParameterizedType
protected GenericMetadataSupport actualParameterizedType(java.lang.Object mock)
- Overrides:
actualParameterizedType
in classReturnsDeepStubs
-
writeReplace
private java.lang.Object writeReplace() throws java.io.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:
java.io.IOException
-
-