From: David S. <ds...@us...> - 2006-10-18 19:36:40
|
Update of /cvsroot/junit/junit/org/junit/runner/notification In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv6163/org/junit/runner/notification Modified Files: Tag: saff_r41_runner_refactoring Failure.java Log Message: PerTestNotifier is gone Index: Failure.java =================================================================== RCS file: /cvsroot/junit/junit/org/junit/runner/notification/Failure.java,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -u -d -r1.4 -r1.4.2.1 --- Failure.java 25 Aug 2006 14:43:03 -0000 1.4 +++ Failure.java 18 Oct 2006 19:36:35 -0000 1.4.2.1 @@ -2,6 +2,7 @@ import java.io.PrintWriter; import java.io.StringWriter; +import java.lang.reflect.InvocationTargetException; import org.junit.runner.Description; @@ -22,10 +23,18 @@ * @param thrownException the exception that was thrown while running the test */ public Failure(Description description, Throwable thrownException) { - fThrownException = thrownException; + fThrownException = findRootCause(thrownException); fDescription= description; } + private static Throwable findRootCause(Throwable thrownException) { + if (thrownException instanceof InvocationTargetException) { + InvocationTargetException ite= (InvocationTargetException) thrownException; + return findRootCause(ite.getTargetException()); + } + return thrownException; + } + /** * @return a user-understandable label for the test */ |