diff options
Diffstat (limited to 'src/org/junit/internal/runners/model/EachTestNotifier.java')
-rw-r--r-- | src/org/junit/internal/runners/model/EachTestNotifier.java | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/org/junit/internal/runners/model/EachTestNotifier.java b/src/org/junit/internal/runners/model/EachTestNotifier.java new file mode 100644 index 0000000..a7d534c --- /dev/null +++ b/src/org/junit/internal/runners/model/EachTestNotifier.java @@ -0,0 +1,51 @@ +/** + * + */ +package org.junit.internal.runners.model; + +import org.junit.internal.AssumptionViolatedException; +import org.junit.runner.Description; +import org.junit.runner.notification.Failure; +import org.junit.runner.notification.RunNotifier; +import org.junit.runners.model.MultipleFailureException; + +public class EachTestNotifier { + private final RunNotifier fNotifier; + + private final Description fDescription; + + public EachTestNotifier(RunNotifier notifier, Description description) { + fNotifier= notifier; + fDescription= description; + } + + public void addFailure(Throwable targetException) { + if (targetException instanceof MultipleFailureException) { + addMultipleFailureException((MultipleFailureException) targetException); + } else { + fNotifier + .fireTestFailure(new Failure(fDescription, targetException)); + } + } + + private void addMultipleFailureException(MultipleFailureException mfe) { + for (Throwable each : mfe.getFailures()) + addFailure(each); + } + + public void addFailedAssumption(AssumptionViolatedException e) { + fNotifier.fireTestAssumptionFailed(new Failure(fDescription, e)); + } + + public void fireTestFinished() { + fNotifier.fireTestFinished(fDescription); + } + + public void fireTestStarted() { + fNotifier.fireTestStarted(fDescription); + } + + public void fireTestIgnored() { + fNotifier.fireTestIgnored(fDescription); + } +}
\ No newline at end of file |