1e0ae5d7e87b1dd6e789803c1b9615a84bd7488b7Ian Parkinson/*
2e0ae5d7e87b1dd6e789803c1b9615a84bd7488b7Ian Parkinson * Copyright (c) 2007 Mockito contributors
3e0ae5d7e87b1dd6e789803c1b9615a84bd7488b7Ian Parkinson * This program is made available under the terms of the MIT License.
4e0ae5d7e87b1dd6e789803c1b9615a84bd7488b7Ian Parkinson */
5e0ae5d7e87b1dd6e789803c1b9615a84bd7488b7Ian Parkinsonpackage org.mockito.invocation;
6e0ae5d7e87b1dd6e789803c1b9615a84bd7488b7Ian Parkinson
7e0ae5d7e87b1dd6e789803c1b9615a84bd7488b7Ian Parkinsonimport org.mockito.Incubating;
8e0ae5d7e87b1dd6e789803c1b9615a84bd7488b7Ian Parkinson
9e0ae5d7e87b1dd6e789803c1b9615a84bd7488b7Ian Parkinsonimport java.io.Serializable;
10e0ae5d7e87b1dd6e789803c1b9615a84bd7488b7Ian Parkinson
11e0ae5d7e87b1dd6e789803c1b9615a84bd7488b7Ian Parkinson/**
12e0ae5d7e87b1dd6e789803c1b9615a84bd7488b7Ian Parkinson * Mockito handler of an invocation on a mock. This is a core part of the API, the heart of Mockito.
13e0ae5d7e87b1dd6e789803c1b9615a84bd7488b7Ian Parkinson * See also the {@link org.mockito.plugins.MockMaker}.
14e0ae5d7e87b1dd6e789803c1b9615a84bd7488b7Ian Parkinson * <p>
15e0ae5d7e87b1dd6e789803c1b9615a84bd7488b7Ian Parkinson * This api is work in progress. Do not provide your own implementations.
16e0ae5d7e87b1dd6e789803c1b9615a84bd7488b7Ian Parkinson * Mockito will provide you with the implementation via other {@link org.mockito.plugins.MockMaker} methods.
17e0ae5d7e87b1dd6e789803c1b9615a84bd7488b7Ian Parkinson */
18e0ae5d7e87b1dd6e789803c1b9615a84bd7488b7Ian Parkinson@Incubating
19e0ae5d7e87b1dd6e789803c1b9615a84bd7488b7Ian Parkinsonpublic interface MockHandler extends Serializable {
20e0ae5d7e87b1dd6e789803c1b9615a84bd7488b7Ian Parkinson    /**
21e0ae5d7e87b1dd6e789803c1b9615a84bd7488b7Ian Parkinson     * Takes an invocation object and handles it.
22e0ae5d7e87b1dd6e789803c1b9615a84bd7488b7Ian Parkinson     * <p>
23e0ae5d7e87b1dd6e789803c1b9615a84bd7488b7Ian Parkinson     * The default implementation provided by Mockito handles invocations by recording
24e0ae5d7e87b1dd6e789803c1b9615a84bd7488b7Ian Parkinson     * method calls on mocks for further verification, captures the stubbing information when mock is stubbed,
25e0ae5d7e87b1dd6e789803c1b9615a84bd7488b7Ian Parkinson     * returns the stubbed values for invocations that have been stubbed, and much more.
26e0ae5d7e87b1dd6e789803c1b9615a84bd7488b7Ian Parkinson     *
27e0ae5d7e87b1dd6e789803c1b9615a84bd7488b7Ian Parkinson     * @param invocation The invocation to handle
28e0ae5d7e87b1dd6e789803c1b9615a84bd7488b7Ian Parkinson     * @return Result
29e0ae5d7e87b1dd6e789803c1b9615a84bd7488b7Ian Parkinson     * @throws Throwable Throwable
30e0ae5d7e87b1dd6e789803c1b9615a84bd7488b7Ian Parkinson     */
31e0ae5d7e87b1dd6e789803c1b9615a84bd7488b7Ian Parkinson    @Incubating
32e0ae5d7e87b1dd6e789803c1b9615a84bd7488b7Ian Parkinson    Object handle(Invocation invocation) throws Throwable;
33e0ae5d7e87b1dd6e789803c1b9615a84bd7488b7Ian Parkinson}
34