Class InvocationImpl

    • Constructor Detail

      • InvocationImpl

        public InvocationImpl​(java.lang.Object mock,
                              MockitoMethod mockitoMethod,
                              java.lang.Object[] args,
                              int sequenceNumber,
                              RealMethod realMethod)
    • Method Detail

      • getMock

        public java.lang.Object getMock()
        Description copied from interface: InvocationOnMock
        returns the mock object
        Specified by:
        getMock in interface InvocationOnMock
        Returns:
        mock object
      • getArguments

        public java.lang.Object[] getArguments()
        Description copied from interface: InvocationOnMock
        returns arguments passed to the method
        Specified by:
        getArguments in interface InvocationOnMock
        Returns:
        arguments
      • getArgumentAt

        public <T> T getArgumentAt​(int index,
                                   java.lang.Class<T> clazz)
        Description copied from interface: InvocationOnMock
        Returns casted argument using position
        Specified by:
        getArgumentAt in interface InvocationOnMock
        Parameters:
        index - argument position
        clazz - argument type
        Returns:
        casted argument on position
      • getSequenceNumber

        public int getSequenceNumber()
        Specified by:
        getSequenceNumber in interface Invocation
        Returns:
        the sequence number of the Invocation. Useful to determine the order of invocations. Used by verification in order.
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • getRawArguments

        public java.lang.Object[] getRawArguments()
        Description copied from interface: Invocation
        Returns unprocessed arguments whereas InvocationOnMock.getArguments() returns arguments already processed (e.g. varargs expended, etc.).
        Specified by:
        getRawArguments in interface Invocation
        Returns:
        unprocessed arguments, exactly as provided to this invocation.
      • callRealMethod

        public java.lang.Object callRealMethod()
                                        throws java.lang.Throwable
        Description copied from interface: InvocationOnMock
        calls real method

        Warning: depending on the real implementation it might throw exceptions

        Specified by:
        callRealMethod in interface InvocationOnMock
        Returns:
        whatever the real method returns / throws
        Throws:
        java.lang.Throwable - in case real method throws
      • stubInfo

        public StubInfo stubInfo()
        Specified by:
        stubInfo in interface Invocation
        Returns:
        the stubbing information for this invocation. May return null - this means the invocation was not stubbed.
      • markStubbed

        public void markStubbed​(StubInfo stubInfo)
        Description copied from interface: Invocation
        Marks this invocation as stubbed.
        Specified by:
        markStubbed in interface Invocation
        Parameters:
        stubInfo - the information about stubbing.
      • isIgnoredForVerification

        public boolean isIgnoredForVerification()
        Description copied from interface: Invocation
        Informs if the invocation participates in verify-no-more-invocations or verification in order.
        Specified by:
        isIgnoredForVerification in interface Invocation
        Returns:
        whether this invocation should be ignored for the purposes of verify-no-more-invocations or verification in order.