Package org.mockito.exceptions.base
Class MockitoAssertionError
java.lang.Object
java.lang.Throwable
java.lang.Error
java.lang.AssertionError
org.mockito.exceptions.base.MockitoAssertionError
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ArgumentsAreDifferent
,MoreThanAllowedActualInvocations
,NeverWantedButInvoked
,NoInteractionsWanted
,TooFewActualInvocations
,TooManyActualInvocations
,VerificationInOrderFailure
,WantedButNotInvoked
Base class for verification errors emitted by Mockito.
Verification errors are triggered by "verify" methods,
for example
Mockito.verify(Object)
or Mockito.verifyNoMoreInteractions(Object...)
.
All error 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 Summary
ConstructorDescriptionMockitoAssertionError
(AssertionError error, String message) Creates a copy of the given assertion error with the custom failure message prepended.MockitoAssertionError
(String message) MockitoAssertionError
(MockitoAssertionError error, String message) Creates a copy of the given assertion error with the custom failure message prepended. -
Method Summary
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
MockitoAssertionError
-
MockitoAssertionError
Creates a copy of the given assertion error with the custom failure message prepended.- Parameters:
error
- The assertion error to copymessage
- The custom message to prepend- Since:
- 2.1.0
-
MockitoAssertionError
Creates a copy of the given assertion error with the custom failure message prepended.- Parameters:
error
- The assertion error to copymessage
- The custom message to prepend- Since:
- 3.3.13
-
-
Method Details
-
getUnfilteredStackTrace
-