aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/junit/runners/model/MultipleFailureException.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/junit/runners/model/MultipleFailureException.java')
-rw-r--r--src/main/java/org/junit/runners/model/MultipleFailureException.java41
1 files changed, 3 insertions, 38 deletions
diff --git a/src/main/java/org/junit/runners/model/MultipleFailureException.java b/src/main/java/org/junit/runners/model/MultipleFailureException.java
index 8e355a7..325c645 100644
--- a/src/main/java/org/junit/runners/model/MultipleFailureException.java
+++ b/src/main/java/org/junit/runners/model/MultipleFailureException.java
@@ -1,13 +1,9 @@
package org.junit.runners.model;
-import java.io.PrintStream;
-import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import org.junit.TestCouldNotBeSkippedException;
-import org.junit.internal.AssumptionViolatedException;
import org.junit.internal.Throwables;
/**
@@ -21,22 +17,12 @@ public class MultipleFailureException extends Exception {
/*
* 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 List<Throwable> fErrors;
public MultipleFailureException(List<Throwable> errors) {
- if (errors.isEmpty()) {
- throw new IllegalArgumentException(
- "List of Throwables must not be empty");
- }
- this.fErrors = new ArrayList<Throwable>(errors.size());
- for (Throwable error : errors) {
- if (error instanceof AssumptionViolatedException) {
- error = new TestCouldNotBeSkippedException((AssumptionViolatedException) error);
- }
- fErrors.add(error);
- }
+ this.fErrors = new ArrayList<Throwable>(errors);
}
public List<Throwable> getFailures() {
@@ -48,32 +34,11 @@ public class MultipleFailureException extends Exception {
StringBuilder sb = new StringBuilder(
String.format("There were %d errors:", fErrors.size()));
for (Throwable e : fErrors) {
- sb.append(String.format("%n %s(%s)", e.getClass().getName(), e.getMessage()));
+ sb.append(String.format("\n %s(%s)", e.getClass().getName(), e.getMessage()));
}
return sb.toString();
}
- @Override
- public void printStackTrace() {
- for (Throwable e: fErrors) {
- e.printStackTrace();
- }
- }
-
- @Override
- public void printStackTrace(PrintStream s) {
- for (Throwable e: fErrors) {
- e.printStackTrace(s);
- }
- }
-
- @Override
- public void printStackTrace(PrintWriter s) {
- for (Throwable e: fErrors) {
- e.printStackTrace(s);
- }
- }
-
/**
* Asserts that a list of throwables is empty. If it isn't empty,
* will throw {@link MultipleFailureException} (if there are