forked from cucumber/cucumber-jvm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDefaultSummaryPrinter.java
46 lines (38 loc) · 1.2 KB
/
DefaultSummaryPrinter.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
44
45
46
package cucumber.runtime;
import cucumber.api.SummaryPrinter;
import java.io.PrintStream;
import java.util.List;
public class DefaultSummaryPrinter implements SummaryPrinter {
private final PrintStream out;
public DefaultSummaryPrinter() {
this.out = System.out;
}
@Override
public void print(cucumber.runtime.Runtime runtime) {
out.println();
printStats(runtime);
out.println();
printErrors(runtime);
printSnippets(runtime);
}
private void printStats(cucumber.runtime.Runtime runtime) {
runtime.printStats(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);
}
}
}
}