1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.plugin.surefire.report;
20
21 import java.io.PrintStream;
22
23 import org.apache.maven.surefire.api.report.TestOutputReportEntry;
24 import org.apache.maven.surefire.api.report.TestSetReportEntry;
25
26 import static java.util.Objects.requireNonNull;
27
28
29
30
31
32
33
34
35
36 public class DirectConsoleOutput implements TestcycleConsoleOutputReceiver {
37 private final PrintStream out;
38
39 private final PrintStream err;
40
41 public DirectConsoleOutput(PrintStream out, PrintStream err) {
42 this.out = requireNonNull(out);
43 this.err = requireNonNull(err);
44 }
45
46 @Override
47 public void writeTestOutput(TestOutputReportEntry reportEntry) {
48 PrintStream stream = reportEntry.isStdOut() ? out : err;
49 if (reportEntry.isNewLine()) {
50 stream.println(reportEntry.getLog());
51 } else {
52 stream.print(reportEntry.getLog());
53 }
54 }
55
56 @Override
57 public void testSetStarting(TestSetReportEntry reportEntry) {}
58
59 @Override
60 public void testSetCompleted(TestSetReportEntry report) {}
61
62 @Override
63 public void close() {}
64 }