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:
java.io.Serializable
- Direct Known Subclasses:
ArgumentsAreDifferent
,MoreThanAllowedActualInvocations
,NeverWantedButInvoked
,NoInteractionsWanted
,TooLittleActualInvocations
,TooManyActualInvocations
,VerificationInOrderFailure
,WantedButNotInvoked
public class MockitoAssertionError extends java.lang.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
-
-
Field Summary
Fields Modifier and Type Field Description private static long
serialVersionUID
private java.lang.StackTraceElement[]
unfilteredStackTrace
-
Constructor Summary
Constructors Constructor Description MockitoAssertionError(java.lang.AssertionError error, java.lang.String message)
Creates a copy of the given assertion error with the custom failure message prepended.MockitoAssertionError(java.lang.String message)
MockitoAssertionError(MockitoAssertionError error, java.lang.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 java.lang.StackTraceElement[]
getUnfilteredStackTrace()
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
unfilteredStackTrace
private final java.lang.StackTraceElement[] unfilteredStackTrace
-
-
Constructor Detail
-
MockitoAssertionError
public MockitoAssertionError(java.lang.String message)
-
MockitoAssertionError
public MockitoAssertionError(MockitoAssertionError error, java.lang.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(java.lang.AssertionError error, java.lang.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
-
-