Class ByteBuddyCrossClassLoaderSerializationSupport.CrossClassLoaderSerializationProxy
- All Implemented Interfaces:
Serializable
- Enclosing class:
ByteBuddyCrossClassLoaderSerializationSupport
When called in the constructor it will serialize the mock in a byte array using a
custom ByteBuddyCrossClassLoaderSerializationSupport.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 ByteBuddyCrossClassLoaderSerializationSupport.MockitoMockObjectInputStream that will be in charge of creating the mock class.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final byte[]private static final longprivate final Class<?> -
Constructor Summary
ConstructorsConstructorDescriptionCrossClassLoaderSerializationProxy(Object mockitoMock) Creates the wrapper that be used in the serialization stream. -
Method Summary
Modifier and TypeMethodDescriptionprivate ObjectResolves 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
-
CrossClassLoaderSerializationProxy
Creates the wrapper that be used in the serialization stream.Immediately serializes the Mockito mock using specifically crafted
ByteBuddyCrossClassLoaderSerializationSupport.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
ByteBuddyCrossClassLoaderSerializationSupport.MockitoMockObjectInputStreamto deserialize the mock.- Returns:
- A deserialized instance of the Mockito mock.
- Throws:
ObjectStreamException
-