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
public class MockitoAssertionError extends AssertionError
Base class for verification errors emitted by Mockito. Verification errors are triggered by "verify" methods, for exampleMockito.verify(Object)
orMockito.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 usinggetUnfilteredStackTrace()
. 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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description MockitoAssertionError(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StackTraceElement[]
getUnfilteredStackTrace()
-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Constructor Detail
-
MockitoAssertionError
public MockitoAssertionError(String message)
-
MockitoAssertionError
public MockitoAssertionError(MockitoAssertionError error, String message)
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
public MockitoAssertionError(AssertionError error, String message)
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 Detail
-
getUnfilteredStackTrace
public StackTraceElement[] getUnfilteredStackTrace()
-
-