Interface MockHandler

All Superinterfaces:
Serializable
All Known Subinterfaces:
InternalMockHandler<T>

public interface MockHandler extends 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 Summary

    Modifier and Type
    Method
    Description
    handle(Invocation invocation)
    Takes an invocation object and handles it.
  • Method Details

    • handle

      Object handle(Invocation invocation) throws 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:
      Throwable - Throwable