public class ThrowableAnticipator
extends org.junit.Assert
ThrowableAnticipator class.
Modifier and Type | Field and Description |
---|---|
static String |
IGNORE_MESSAGE
Constant
IGNORE_MESSAGE="*** ThrowableAnticipator ignore Throwab"{trunked} |
Constructor and Description |
---|
ThrowableAnticipator()
Create a new anticipator with default failFast setting of true.
|
ThrowableAnticipator(boolean failFast)
Create a new anticipator with the specified failFast setting.
|
Modifier and Type | Method and Description |
---|---|
void |
anticipate(Throwable t)
Anticipate a specific java.lang.Throwable.
|
void |
fail(String message,
Throwable t)
Generate an AssertionFailedError with the specified cause.
|
boolean |
isFailFast()
Returns the failFast value for this anticipator.
|
void |
reset()
Reset the class back to its initial state as if it had just been
instantiated.
|
void |
setFailFast(boolean failFast)
Set the failFast value for this anticipator.
|
void |
throwableReceived(Throwable t)
Process a received throwable.
|
void |
verifyAnticipated()
Perform after-test verification that all anticipated java.lang.Throwable's
have been seen and that no unanticipated java.lang.Throwable's have been
seen.
|
assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertThat, assertThat, assertTrue, assertTrue, fail, fail
public static final String IGNORE_MESSAGE
IGNORE_MESSAGE="*** ThrowableAnticipator ignore Throwab"{trunked}
public ThrowableAnticipator()
public ThrowableAnticipator(boolean failFast)
failFast
- whether unanticipated exceptions will cause an immediate
junit.framework.Assert#fail(String). See #setFailFast(boolean)
for details.public void anticipate(Throwable t)
t
- The java.lang.Throwable to anticipate. Both the class and the
message will be matched.public void throwableReceived(Throwable t)
t
- The received throwable.junit.framework.AssertionFailedError
- if failFast is set to true and an
unanticipated java.lang.Throwable is received.public void setFailFast(boolean failFast) throws junit.framework.AssertionFailedError
failFast
- when set to true (the default), an unanticipated throwable
will cause #receiveThrowable(Throwable) to call
junit.framework.Assert#fail(). When set to false, the error will
be delayed until #verifyAnticipated() is called.junit.framework.AssertionFailedError
- if failFast is being changed from false to
true and one or more unanticipated exceptions have been received.public boolean isFailFast()
public void reset()
public void verifyAnticipated() throws junit.framework.AssertionFailedError
junit.framework.AssertionFailedError
- if one or more anticipated Throwables were
not received or one or more unanticipated Throwables were received.public void fail(String message, Throwable t) throws junit.framework.AssertionFailedError
message
- error messaget
- java.lang.Throwable that caused this error to be thrownjunit.framework.AssertionFailedError
- always thrown. Generated based on the
parameters passed.Copyright © 2021. All rights reserved.