01: /*
02: * User: Michael Rettig
03: * Date: Sep 14, 2002
04: * Time: 6:22:14 PM
05: */
06: package net.sourceforge.jaxor.util.tests;
07:
08: import net.sourceforge.jaxor.example.tests.JaxorTestCase;
09: import net.sourceforge.jaxor.util.SystemException;
10:
11: import java.io.ByteArrayOutputStream;
12: import java.io.PrintStream;
13:
14: public class SystemExceptionTest extends JaxorTestCase {
15:
16: public void testSerialization() {
17: SystemException exc = new SystemException(new Exception("exc"));
18: ByteArrayOutputStream out = new ByteArrayOutputStream();
19: exc.printStackTrace(new PrintStream(out));
20: SystemException ser = (SystemException) serialize(exc);
21: ByteArrayOutputStream serOut = new ByteArrayOutputStream();
22: ser.printStackTrace(new PrintStream(serOut));
23: assertEquals(new String(out.toByteArray()), new String(serOut
24: .toByteArray()));
25: }
26:
27: public void testGetCause() {
28: Exception cause = new Exception("exc");
29: SystemException exc = new SystemException(cause);
30: assertTrue(cause == exc.getCauseList().get(0));
31: }
32: }
|