blob: a7d534c5abbaf9eb1fe417bcdea95c103250422e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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);
}
}
|