Class AcrossJVMSerializationFeature.AcrossJVMMockSerializationProxy
java.lang.Object
org.powermock.api.mockito.repackaged.AcrossJVMSerializationFeature.AcrossJVMMockSerializationProxy
- All Implemented Interfaces:
Serializable
- Enclosing class:
- AcrossJVMSerializationFeature
public static class AcrossJVMSerializationFeature.AcrossJVMMockSerializationProxy
extends Object
implements Serializable
This is the serialization proxy that will encapsulate the real mock data as a byte array.
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.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final byte[]
private static final long
private final Class
-
Constructor Summary
ConstructorsConstructorDescriptionAcrossJVMMockSerializationProxy
(Object mockitoMock) Creates the wrapper that be used in the serialization stream. -
Method Summary
Modifier and TypeMethodDescriptionprivate Object
Resolves the proxy to a new deserialized instance of the Mockito mock.
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
serializedMock
private final byte[] serializedMock -
typeToMock
-
extraInterfaces
-
-
Constructor Details
-
AcrossJVMMockSerializationProxy
Creates the wrapper that be used in the serialization stream.Immediately serializes the Mockito mock using specifically crafted
AcrossJVMSerializationFeature.MockitoMockObjectOutputStream
, in a byte array.- Parameters:
mockitoMock
- The Mockito mock to serialize.- Throws:
IOException
-
-
Method Details
-
readResolve
Resolves the proxy to a new deserialized instance of the Mockito mock.Uses the custom crafted
AcrossJVMSerializationFeature.MockitoMockObjectInputStream
to deserialize the mock.- Returns:
- A deserialized instance of the Mockito mock.
- Throws:
ObjectStreamException
-