|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjunit.framework.Assert
org.opennms.test.ThrowableAnticipator
public class ThrowableAnticipator
| Field Summary | |
|---|---|
static String |
IGNORE_MESSAGE
|
| Constructor Summary | |
|---|---|
ThrowableAnticipator()
Create a new anticipator with default failFast setting of true. |
|
ThrowableAnticipator(boolean failFast)
Create a new anticipator with the specified failFast setting. |
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class junit.framework.Assert |
|---|
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String IGNORE_MESSAGE
| Constructor Detail |
|---|
public ThrowableAnticipator()
public ThrowableAnticipator(boolean failFast)
failFast - whether unanticipated exceptions will cause an immediate
junit.framework.Assert#fail(String). See #setFailFast(boolean)
for details.| Method Detail |
|---|
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 thrown
junit.framework.AssertionFailedError - always thrown. Generated based on the
parameters passed.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||