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