Class NullResultGuardian<T>

java.lang.Object
org.mockito.internal.handler.NullResultGuardian<T>
All Implemented Interfaces:
Serializable, MockHandler<T>

class NullResultGuardian<T> extends Object implements MockHandler<T>
Protects the results from delegate MockHandler. Makes sure the results are valid. by Szczepan Faber, created at: 5/22/12
  • Field Details

  • Constructor Details

    • NullResultGuardian

      public NullResultGuardian(MockHandler<T> delegate)
  • Method Details

    • handle

      public Object handle(Invocation invocation) throws Throwable
      Description copied from interface: MockHandler
      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.

      Specified by:
      handle in interface MockHandler<T>
      Parameters:
      invocation - The invocation to handle
      Returns:
      Result
      Throws:
      Throwable - Throwable
    • getMockSettings

      public MockCreationSettings<T> getMockSettings()
      Description copied from interface: MockHandler
      Read-only settings the mock object was created with. See Mockito.mock(Class, MockSettings)
      Specified by:
      getMockSettings in interface MockHandler<T>
      Returns:
      read-only settings of the mock
    • getInvocationContainer

      public InvocationContainer getInvocationContainer()
      Description copied from interface: MockHandler
      Returns the object that holds all invocations on the mock object, including stubbings with declared answers. Do not provide your own implementation. Returned object is an internal implementation, hidden beneath a public marker interface.

      Please do not provide your own implementation of InvocationContainer interface at this point. If you have a use case that requires your own implementation of InvocationContainer please reach out to us. You can open a ticket in our issue tracker to start a discussion.

      Specified by:
      getInvocationContainer in interface MockHandler<T>
      Returns:
      container of invocations, stubbings, and answers of the mock. The container is not part of the public API, please do not cast it or provide custom implementations.