Class AcrossJVMSerializationFeature.AcrossJVMMockSerializationProxy
- java.lang.Object
-
- org.powermock.api.mockito.repackaged.AcrossJVMSerializationFeature.AcrossJVMMockSerializationProxy
-
- All Implemented Interfaces:
java.io.Serializable
- Enclosing class:
- AcrossJVMSerializationFeature
public static class AcrossJVMSerializationFeature.AcrossJVMMockSerializationProxy extends java.lang.Object implements java.io.SerializableThis 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.MockitoMockObjectOutputStreamthat 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 customAcrossJVMSerializationFeature.MockitoMockObjectInputStreamthat will be in charge of creating the mock class.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Set<java.lang.Class>extraInterfacesprivate byte[]serializedMockprivate static longserialVersionUIDprivate java.lang.ClasstypeToMock
-
Constructor Summary
Constructors Constructor Description AcrossJVMMockSerializationProxy(java.lang.Object mockitoMock)Creates the wrapper that be used in the serialization stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.ObjectreadResolve()Resolves the proxy to a new deserialized instance of the Mockito mock.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
serializedMock
private final byte[] serializedMock
-
typeToMock
private final java.lang.Class typeToMock
-
extraInterfaces
private final java.util.Set<java.lang.Class> extraInterfaces
-
-
Constructor Detail
-
AcrossJVMMockSerializationProxy
public AcrossJVMMockSerializationProxy(java.lang.Object mockitoMock) throws java.io.IOExceptionCreates 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:
java.io.IOException
-
-
Method Detail
-
readResolve
private java.lang.Object readResolve() throws java.io.ObjectStreamExceptionResolves the proxy to a new deserialized instance of the Mockito mock.Uses the custom crafted
AcrossJVMSerializationFeature.MockitoMockObjectInputStreamto deserialize the mock.- Returns:
- A deserialized instance of the Mockito mock.
- Throws:
java.io.ObjectStreamException
-
-