-
-
Notifications
You must be signed in to change notification settings - Fork 2k
/
SummaryPrinter.java
43 lines (36 loc) · 1.13 KB
/
SummaryPrinter.java
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
package cucumber.runtime.snippets;
import java.io.PrintStream;
import java.util.List;
public class SummaryPrinter {
private final PrintStream out;
public SummaryPrinter(PrintStream out) {
this.out = out;
}
public void print(cucumber.runtime.Runtime runtime) {
out.println();
printSummary(runtime);
out.println();
printErrors(runtime);
printSnippets(runtime);
}
private void printSummary(cucumber.runtime.Runtime runtime) {
runtime.printSummary(out);
}
private void printErrors(cucumber.runtime.Runtime runtime) {
for (Throwable error : runtime.getErrors()) {
error.printStackTrace(out);
out.println();
}
}
private void printSnippets(cucumber.runtime.Runtime runtime) {
List<String> snippets = runtime.getSnippets();
if (!snippets.isEmpty()) {
out.append("\n");
out.println("You can implement missing steps with the snippets below:");
out.println();
for (String snippet : snippets) {
out.println(snippet);
}
}
}
}