Class AcrossJVMSerializationFeature.AcrossJVMMockSerializationProxy

    • 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.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

      • AcrossJVMMockSerializationProxy

        public AcrossJVMMockSerializationProxy​(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 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.ObjectStreamException
        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:
        java.io.ObjectStreamException