|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.qpid.test.framework.ExceptionMonitor
public class ExceptionMonitor
An exception monitor, listens for JMS exception on a connection or consumer. It record all exceptions that it receives and provides methods to test the number and type of exceptions received.
Responsibilities | Collaborations |
---|---|
Record all exceptions received. |
Field Summary | |
---|---|
(package private) List<Exception> |
exceptions
Holds the received exceptions. |
Constructor Summary | |
---|---|
ExceptionMonitor()
|
Method Summary | |
---|---|
boolean |
assertExceptionOfType(Class exceptionClass)
Checks that at least one exception of the the specified type, has been received. |
boolean |
assertNoExceptions()
Checks that no exceptions have been received. |
boolean |
assertOneJMSException()
Checks that exactly one exception has been received. |
boolean |
assertOneJMSExceptionWithLinkedCause(Class aClass)
Checks that exactly one exception, with a linked cause of the specified type, has been received. |
static String |
getStackTrace(Throwable t)
Prints an exception stack trace into a string. |
void |
onException(JMSException e)
Receives incoming exceptions. |
void |
reset()
Clears the record of received exceptions. |
int |
size()
Reports the number of exceptions held by this monitor. |
String |
toString()
Provides a dump of the stack traces of all exceptions that this exception monitor was notified of. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
List<Exception> exceptions
Constructor Detail |
---|
public ExceptionMonitor()
Method Detail |
---|
public void onException(JMSException e)
onException
in interface ExceptionListener
e
- The exception to record.public boolean assertNoExceptions()
public boolean assertOneJMSException()
public boolean assertOneJMSExceptionWithLinkedCause(Class aClass)
aClass
- The type of the linked cause.
public boolean assertExceptionOfType(Class exceptionClass)
exceptionClass
- The type of the exception.
public int size()
public void reset()
public String toString()
toString
in class Object
public static String getStackTrace(Throwable t)
t
- The throwable to get the stack trace from.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |