1 8 package org.apache.avalon.excalibur.testcase; 9 10 import junit.framework.AssertionFailedError; 11 12 import org.apache.avalon.framework.ExceptionUtil; 13 import org.apache.avalon.framework.CascadingThrowable; 14 15 import java.io.PrintStream ; 16 import java.io.PrintWriter ; 17 18 25 public class CascadingAssertionFailedError extends AssertionFailedError implements CascadingThrowable { 26 private final Throwable m_throwable; 27 28 31 public CascadingAssertionFailedError() 32 { 33 this( null, null ); 34 } 35 36 39 public CascadingAssertionFailedError(String message) 40 { 41 this( message, null ); 42 } 43 44 47 public CascadingAssertionFailedError(String message, Throwable parentThrowable) 48 { 49 super( message ); 50 m_throwable = parentThrowable; 51 } 52 53 56 public final Throwable getCause() 57 { 58 return m_throwable; 59 } 60 61 public final void printStackTrace() 62 { 63 super.printStackTrace(); 64 System.out.print( ExceptionUtil.printStackTrace( m_throwable, 8, true ) ); 65 } 66 67 public final void printStackTrace( PrintStream stream ) 68 { 69 super.printStackTrace( stream ); 70 stream.print( ExceptionUtil.printStackTrace( m_throwable, 8, true ) ); 71 } 72 73 public final void printStackTrace( PrintWriter writer ) 74 { 75 super.printStackTrace( writer ); 76 writer.print( ExceptionUtil.printStackTrace( m_throwable, 8, true ) ); 77 } 78 } 79 | Popular Tags |