• 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.listeners;
6 
7 import org.mockito.exceptions.PrintableInvocation;
8 import org.mockito.invocation.DescribedInvocation;
9 
10 /**
11  * Represent a method call on a mock.
12  *
13  * <p>
14  *     Contains the information on the mock, the location of the stub
15  *     the return value if it returned something (maybe null), or an
16  *     exception if one was thrown when the method was invoked.
17  * </p>
18  */
19 public interface MethodInvocationReport {
20     /**
21      * The return type is deprecated, please assign the return value from this method
22      * to the {@link DescribedInvocation} type. Sorry for inconvenience but we had to move
23      * {@link PrintableInvocation} to better place to keep the API consistency.
24      *
25      * @return Information on the method call, never {@code null}
26      */
getInvocation()27     DescribedInvocation getInvocation();
28 
29     /**
30      * @return The resulting value of the method invocation, may be <code>null</code>
31      */
getReturnedValue()32     Object getReturnedValue();
33 
34     /**
35      * @return The throwable raised by the method invocation, maybe <code>null</code>
36      */
getThrowable()37     Throwable getThrowable();
38 
39     /**
40      * @return <code>true</code> if an exception was raised, <code>false</code> otherwise
41      */
threwException()42     boolean threwException();
43 
44     /**
45      * @return Location of the stub invocation
46      */
getLocationOfStubbing()47     String getLocationOfStubbing();
48 }
49