KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > inversoft > junit > internal > AssertionFailedErrorWrapper


1 /*
2  * Copyright (c) 2003, Inversoft
3  *
4  * This software is distribuable under the GNU Lesser General Public License.
5  * For more information visit gnu.org.
6  */

7 package com.inversoft.junit.internal;
8
9
10 import java.io.PrintStream JavaDoc;
11 import java.io.PrintWriter JavaDoc;
12
13 import junit.framework.AssertionFailedError;
14
15
16 /**
17  * This class mimics the AssertionFailedError thrown by JUnit.
18  * This is done so that when tests fail in the 'test location'
19  * side, they appear as though they failed on the client side
20  * (seamless).
21  *
22  * @author Brian Pontarelli
23  * @since 1.0
24  * @version 1.0
25  */

26 public class AssertionFailedErrorWrapper extends AssertionFailedError
27 {
28     /**
29      * The test location stack trace
30      */

31     private String JavaDoc stackTrace;
32
33
34     /**
35      * Constructs a new wrapper using the given message and stack trace
36      */

37     public AssertionFailedErrorWrapper(String JavaDoc message, String JavaDoc stackTrace)
38     {
39         super(message);
40         this.stackTrace = stackTrace;
41     }
42
43
44     /**
45      * Prints out the stack trace of the test location error NOT this error
46      */

47     public void printStackTrace(PrintStream JavaDoc ps)
48     {
49         ps.print(stackTrace);
50     }
51
52     /**
53      * Prints out the stack trace of the test location error NOT this error
54      */

55     public void printStackTrace(PrintWriter JavaDoc pw)
56     {
57         pw.print(stackTrace);
58     }
59 }
60
Popular Tags