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