diff options
Diffstat (limited to 'src/main/java/org/junit/runner/notification/Failure.java')
-rw-r--r-- | src/main/java/org/junit/runner/notification/Failure.java | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/main/java/org/junit/runner/notification/Failure.java b/src/main/java/org/junit/runner/notification/Failure.java index 4551302..c03b4c1 100644 --- a/src/main/java/org/junit/runner/notification/Failure.java +++ b/src/main/java/org/junit/runner/notification/Failure.java @@ -1,8 +1,9 @@ package org.junit.runner.notification; +import java.io.PrintWriter; import java.io.Serializable; +import java.io.StringWriter; -import org.junit.internal.Throwables; import org.junit.runner.Description; /** @@ -20,7 +21,7 @@ public class Failure implements Serializable { /* * We have to use the f prefix until the next major release to ensure * serialization compatibility. - * See https://github.com/junit-team/junit4/issues/976 + * See https://github.com/junit-team/junit/issues/976 */ private final Description fDescription; private final Throwable fThrownException; @@ -64,19 +65,15 @@ public class Failure implements Serializable { } /** - * Gets the printed form of the exception and its stack trace. + * Convenience method + * + * @return the printed form of the exception */ public String getTrace() { - return Throwables.getStacktrace(getException()); - } - - /** - * Gets a the printed form of the exception, with a trimmed version of the stack trace. - * This method will attempt to filter out frames of the stack trace that are below - * the test method call. - */ - public String getTrimmedTrace() { - return Throwables.getTrimmedStackTrace(getException()); + StringWriter stringWriter = new StringWriter(); + PrintWriter writer = new PrintWriter(stringWriter); + getException().printStackTrace(writer); + return stringWriter.toString(); } /** |