Class ByteBuddyCrossClassLoaderSerializationSupport.CrossClassLoaderSerializationProxy
- java.lang.Object
-
- org.mockito.internal.creation.bytebuddy.ByteBuddyCrossClassLoaderSerializationSupport.CrossClassLoaderSerializationProxy
-
- All Implemented Interfaces:
java.io.Serializable
- Enclosing class:
- ByteBuddyCrossClassLoaderSerializationSupport
public static class ByteBuddyCrossClassLoaderSerializationSupport.CrossClassLoaderSerializationProxy extends java.lang.Object implements java.io.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
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 customByteBuddyCrossClassLoaderSerializationSupport.MockitoMockObjectInputStream
that 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<?>>
extraInterfaces
private byte[]
serializedMock
private static long
serialVersionUID
private java.lang.Class<?>
typeToMock
-
Constructor Summary
Constructors Constructor Description CrossClassLoaderSerializationProxy(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.Object
readResolve()
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
-
CrossClassLoaderSerializationProxy
public CrossClassLoaderSerializationProxy(java.lang.Object mockitoMock) throws java.io.IOException
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:
java.io.IOException
-
-
Method Detail
-
readResolve
private java.lang.Object readResolve() throws java.io.ObjectStreamException
Resolves the proxy to a new deserialized instance of the Mockito mock.Uses the custom crafted
ByteBuddyCrossClassLoaderSerializationSupport.MockitoMockObjectInputStream
to deserialize the mock.- Returns:
- A deserialized instance of the Mockito mock.
- Throws:
java.io.ObjectStreamException
-
-