Class MockitoException

All Implemented Interfaces:
Serializable
Direct Known Subclasses:
CannotStubVoidMethodWithReturnValue, CannotVerifyStubOnlyMock, DoNotMockException, FriendlyReminderException, InjectMocksException, InstantiationException, InvalidUseOfMatchersException, MissingMethodInvocationException, MockitoConfigurationException, NotAMockException, NullInsteadOfMockException, PotentialStubbingProblem, RedundantListenerException, SmartNullPointerException, UnfinishedMockingSessionException, UnfinishedStubbingException, UnfinishedVerificationException, UnnecessaryStubbingException, WrongTypeOfReturnValue

public class MockitoException extends RuntimeException
Raised by mockito to emit an error either due to Mockito, or due to the User. All exception classes that inherit from this class will have the stack trace filtered. Filtering removes Mockito internal stack trace elements to provide clean stack traces and improve productivity.

The stack trace is filtered from mockito calls if you are using Throwable.getStackTrace(). For debugging purpose though you can still access the full stacktrace using getUnfilteredStackTrace(). However note that other calls related to the stackTrace will refer to the filter stacktrace.

Advanced users and framework integrators can control stack trace filtering behavior via StackTraceCleanerProvider classpath plugin.

See Also:
  • Constructor Details

    • MockitoException

      public MockitoException(String message, Throwable t)
    • MockitoException

      public MockitoException(String message)
  • Method Details