Class ByteBuddyCrossClassLoaderSerializationSupport.CrossClassLoaderSerializationProxy

    • 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • 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