1/*
2 * Copyright (c) 2007 Mockito contributors
3 * This program is made available under the terms of the MIT License.
4 */
5package org.mockito.invocation;
6
7/**
8 * A method call on a mock object. Contains all information and state needed for the Mockito framework to operate.
9 * This API might be useful for developers who extend Mockito.
10 * <p>
11 * The javadoc does not have lots of examples or documentation because its audience is different.
12 * Vast majority of users don't need to use the Invocation. It's mostly useful for other framework authors
13 * that extend Mockito.
14 *
15 * @since 1.9.5
16 */
17public interface Invocation extends InvocationOnMock, DescribedInvocation {
18
19    /**
20     * @return whether the invocation has been already verified.
21     * Needed for {@link org.mockito.Mockito#verifyNoMoreInteractions(Object...)}
22     */
23    boolean isVerified();
24
25    /**
26     * @return the sequence number of the Invocation. Useful to determine the order of invocations.
27     * Used by verification in order.
28     */
29    int getSequenceNumber();
30
31    /**
32     * @return the location in code of this invocation.
33     */
34    Location getLocation();
35
36    /**
37     * Returns unprocessed arguments whereas {@link #getArguments()} returns
38     * arguments already processed (e.g. varargs expended, etc.).
39     *
40     * @return unprocessed arguments, exactly as provided to this invocation.
41     */
42    Object[] getRawArguments();
43
44    /**
45     * Returns unprocessed arguments whereas {@link #getArguments()} returns
46     * arguments already processed (e.g. varargs expended, etc.).
47     *
48     * @return unprocessed arguments, exactly as provided to this invocation.
49     */
50    Class<?> getRawReturnType();
51
52    /**
53     * Marks this invocation as verified so that it will not cause verification error at
54     * {@link org.mockito.Mockito#verifyNoMoreInteractions(Object...)}
55     */
56    void markVerified();
57
58    /**
59     * @return the stubbing information for this invocation. May return null - this means
60     * the invocation was not stubbed.
61     */
62    StubInfo stubInfo();
63
64    /**
65     * Marks this invocation as stubbed.
66     *
67     * @param stubInfo the information about stubbing.
68     */
69    void markStubbed(StubInfo stubInfo);
70
71    /**
72     * Informs if the invocation participates in verify-no-more-invocations or verification in order.
73     *
74     * @return whether this invocation should be ignored for the purposes of
75     * verify-no-more-invocations or verification in order.
76     */
77    boolean isIgnoredForVerification();
78
79    /**
80     * Configures this invocation to be ignored for verify-no-more-invocations or verification in order.
81     * See also {@link #isIgnoredForVerification()}
82     */
83    void ignoreForVerification();
84}
85