public class ServletExceptionWrapper
extends java.lang.Throwable
Throwable
object. Whenever an exception occurs
in a test case executed on the server side, the text of this exception
along with the stack trace as a String are sent back in the HTTP response.
This is because some exceptions are not serializable and because the stack
trace is implemented as a transient
variable by the JDK so it
cannot be transported in the response. However, we need to send a real
exception object to JUnit so that the exception stack trace will be printed
in the JUnit console. This class does this by being a Throwable
and overloading the printStackTrace()
methods to print a
text stack trace.Constructor and Description |
---|
ServletExceptionWrapper()
Standard throwable constructor.
|
ServletExceptionWrapper(java.lang.String theMessage)
Standard throwable constructor.
|
ServletExceptionWrapper(java.lang.String theMessage,
java.lang.String theClassName,
java.lang.String theStackTrace)
The constructor to use to simulate a real exception.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getWrappedClassName() |
void |
printStackTrace(java.io.PrintStream thePs)
Simulates a printing of a stack trace by printing the string stack trace
|
void |
printStackTrace(java.io.PrintWriter thePw)
Simulates a printing of a stack trace by printing the string stack trace
|
public ServletExceptionWrapper(java.lang.String theMessage)
theMessage
- the exception messagepublic ServletExceptionWrapper()
public ServletExceptionWrapper(java.lang.String theMessage, java.lang.String theClassName, java.lang.String theStackTrace)
theMessage
- the server exception messagetheClassName
- the server exception class nametheStackTrace
- the server exception stack tracepublic void printStackTrace(java.io.PrintStream thePs)
printStackTrace
in class java.lang.Throwable
thePs
- the stream to which to output the stack tracepublic void printStackTrace(java.io.PrintWriter thePw)
printStackTrace
in class java.lang.Throwable
thePw
- the writer to which to output the stack tracepublic java.lang.String getWrappedClassName()
Copyright © 2000-2004 Apache Software Foundation. All Rights Reserved.