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