Interface Invocation

  • All Superinterfaces:
    DescribedInvocation, InvocationOnMock, Serializable

    @NotExtensible
    public interface Invocation
    extends InvocationOnMock, DescribedInvocation
    A method call on a mock object. Contains all information and state needed for the Mockito framework to operate. This API might be useful for developers who extend Mockito.

    The javadoc does not have lots of examples or documentation because its audience is different. Vast majority of users don't need to use the Invocation. It's mostly useful for other framework authors that extend Mockito.

    Creating own implementations of this interface is not recommended. If you are a framework integrator and you need to programmatically create instances of invocations see InvocationFactory.

    Since:
    1.9.5
    • Method Detail

      • getSequenceNumber

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

        Class<?> getRawReturnType()
        Returns unprocessed arguments whereas InvocationOnMock.getArguments() returns arguments already processed (e.g. varargs expended, etc.).
        Returns:
        unprocessed arguments, exactly as provided to this invocation.
        Since:
        4.7.0
      • stubInfo

        StubInfo stubInfo()
        Returns:
        the stubbing information for this invocation. May return null - this means the invocation was not stubbed.
      • markStubbed

        void markStubbed​(StubInfo stubInfo)
        Marks this invocation as stubbed.
        Parameters:
        stubInfo - the information about stubbing.
      • isIgnoredForVerification

        boolean isIgnoredForVerification()
        Informs if the invocation participates in verify-no-more-invocations or verification in order.
        Returns:
        whether this invocation should be ignored for the purposes of verify-no-more-invocations or verification in order.
      • ignoreForVerification

        void ignoreForVerification()
        Configures this invocation to be ignored for verify-no-more-invocations or verification in order. See also isIgnoredForVerification()