Interface MockHandler

  • All Superinterfaces:
    java.io.Serializable
    All Known Subinterfaces:
    InternalMockHandler<T>

    public interface MockHandler
    extends java.io.Serializable
    Mockito handler of an invocation on a mock. This is a core part of the API, the heart of Mockito. See also the MockMaker.

    This api is work in progress. Do not provide your own implementations. Mockito will provide you with the implementation via other MockMaker methods.

    • Method Detail

      • handle

        java.lang.Object handle​(Invocation invocation)
                         throws java.lang.Throwable
        Takes an invocation object and handles it.

        The default implementation provided by Mockito handles invocations by recording method calls on mocks for further verification, captures the stubbing information when mock is stubbed, returns the stubbed values for invocations that have been stubbed, and much more.

        Parameters:
        invocation - The invocation to handle
        Returns:
        Result
        Throws:
        java.lang.Throwable - Throwable