Class ForwardsInvocations

  • All Implemented Interfaces:
    java.io.Serializable, Answer<java.lang.Object>

    public class ForwardsInvocations
    extends java.lang.Object
    implements Answer<java.lang.Object>, java.io.Serializable
    Internal answer to forward invocations on a real instance.
    Since:
    1.9.5
    See Also:
    Serialized Form
    • Field Detail

      • delegatedObject

        private java.lang.Object delegatedObject
    • Constructor Detail

      • ForwardsInvocations

        public ForwardsInvocations​(java.lang.Object delegatedObject)
    • Method Detail

      • answer

        public java.lang.Object answer​(InvocationOnMock invocation)
                                throws java.lang.Throwable
        Specified by:
        answer in interface Answer<java.lang.Object>
        Parameters:
        invocation - the invocation on the mock.
        Returns:
        the value to be returned
        Throws:
        java.lang.Throwable - the throwable to be thrown
      • getDelegateMethod

        private java.lang.reflect.Method getDelegateMethod​(java.lang.reflect.Method mockMethod)
                                                    throws java.lang.NoSuchMethodException
        Throws:
        java.lang.NoSuchMethodException
      • compatibleReturnTypes

        private static boolean compatibleReturnTypes​(java.lang.Class<?> superType,
                                                     java.lang.Class<?> subType)