1 54 55 package junitx.framework; 56 57 import java.io.PrintStream ; 58 import java.io.PrintWriter ; 59 60 74 public class AssertionFailedError extends junit.framework.AssertionFailedError { 75 76 private Throwable cause; 77 78 87 public AssertionFailedError(Throwable cause) { 88 this(cause == null ? null : cause.toString(), cause); 89 } 90 91 103 public AssertionFailedError(String message, 104 Throwable cause) { 105 super(message); 106 this.cause = cause; 107 } 108 109 114 public Throwable getCause() { 115 return cause; 116 } 117 118 127 public void printStackTrace() { 128 printStackTrace(System.err); 129 } 130 131 136 public void printStackTrace(PrintStream s) { 137 super.printStackTrace(s); 138 if (this.cause != null) { 139 s.print("Caused by: "); 140 this.cause.printStackTrace(s); 141 } 142 } 143 144 150 public void printStackTrace(PrintWriter s) { 151 super.printStackTrace(s); 152 if (this.cause != null) { 153 s.print("Caused by: "); 154 this.cause.printStackTrace(s); 155 } 156 } 157 158 } 159 | Popular Tags |