public static class AcrossJVMSerializationFeature.AcrossJVMMockSerializationProxy
extends java.lang.Object
implements java.io.Serializable
When called in the constructor it will serialize the mock in a byte array using a
custom AcrossJVMSerializationFeature.MockitoMockObjectOutputStream
that
will annotate the mock class in the stream.
Other information are used in this class in order to facilitate deserialization.
Deserialization of the mock will be performed by the readResolve()
method via
the custom AcrossJVMSerializationFeature.MockitoMockObjectInputStream
that will be in charge of creating the mock class.
Modifier and Type | Field and Description |
---|---|
private java.util.Set<java.lang.Class> |
extraInterfaces |
private byte[] |
serializedMock |
private static long |
serialVersionUID |
private java.lang.Class |
typeToMock |
Constructor and Description |
---|
AcrossJVMMockSerializationProxy(java.lang.Object mockitoMock)
Creates the wrapper that be used in the serialization stream.
|
Modifier and Type | Method and Description |
---|---|
private java.lang.Object |
readResolve()
Resolves the proxy to a new deserialized instance of the Mockito mock.
|
private static final long serialVersionUID
private final byte[] serializedMock
private final java.lang.Class typeToMock
private final java.util.Set<java.lang.Class> extraInterfaces
public AcrossJVMMockSerializationProxy(java.lang.Object mockitoMock) throws java.io.IOException
Immediately serializes the Mockito mock using specifically crafted
AcrossJVMSerializationFeature.MockitoMockObjectOutputStream
,
in a byte array.
mockitoMock
- The Mockito mock to serialize.java.io.IOException
private java.lang.Object readResolve() throws java.io.ObjectStreamException
Uses the custom crafted AcrossJVMSerializationFeature.MockitoMockObjectInputStream
to deserialize the mock.
java.io.ObjectStreamException