1 package org.apache.maven.plugin.surefire.booterclient.output;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import junit.framework.TestCase;
23 import org.apache.maven.surefire.report.CategorizedReportEntry;
24 import org.apache.maven.surefire.report.ReportEntry;
25
26
27
28
29
30
31
32 public abstract class AbstractOutputConsumerTestCase
33 extends TestCase
34 {
35 private OutputConsumer outputConsumer;
36
37 private String line;
38
39 private ReportEntry reportEntry;
40
41 protected void setUp()
42 throws Exception
43 {
44 super.setUp();
45 setLine( "line" );
46 setReportEntry( CategorizedReportEntry.nameGroup( "name", "group" ) );
47 }
48
49 public void setOutputConsumer( OutputConsumer outputConsumer )
50 {
51 this.outputConsumer = outputConsumer;
52 }
53
54 public OutputConsumer getOutputConsumer()
55 {
56 return outputConsumer;
57 }
58
59 public void setLine( String line )
60 {
61 this.line = line;
62 }
63
64 public String getLine()
65 {
66 return line;
67 }
68
69 public void setReportEntry( ReportEntry reportEntry )
70 {
71 this.reportEntry = reportEntry;
72 }
73
74 public ReportEntry getReportEntry()
75 {
76 return reportEntry;
77 }
78
79 public void testConsumeHeaderLine()
80 {
81 getOutputConsumer().testSetStarting( getReportEntry() );
82 getOutputConsumer().consumeHeaderLine( getLine() );
83 getOutputConsumer().testSetCompleted();
84 }
85
86 public void testConsumeMessageLine()
87 {
88 getOutputConsumer().testSetStarting( getReportEntry() );
89 getOutputConsumer().consumeMessageLine( getLine() );
90 getOutputConsumer().testSetCompleted();
91 }
92
93 public void testConsumeFooterLine()
94 {
95 getOutputConsumer().testSetStarting( getReportEntry() );
96 getOutputConsumer().consumeFooterLine( getLine() );
97 getOutputConsumer().testSetCompleted();
98 }
99
100 public void testConsumeOutputLine()
101 throws Exception
102 {
103 getOutputConsumer().testSetStarting( getReportEntry() );
104 getOutputConsumer().consumeOutputLine( getLine() );
105 getOutputConsumer().testSetCompleted();
106 }
107
108 public void testTestSetStarting()
109 {
110 getOutputConsumer().testSetStarting( getReportEntry() );
111 }
112
113 public void testTestSetCompleted()
114 {
115 getOutputConsumer().testSetStarting( getReportEntry() );
116 getOutputConsumer().testSetCompleted();
117 }
118
119 }