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 org.jmock.Mock;
23 import org.jmock.core.constraint.IsEqual;
24 import org.jmock.core.matcher.InvokeOnceMatcher;
25
26
27
28
29
30
31
32 public class OutputConsumerProxyTest
33 extends AbstractOutputConsumerTestCase
34 {
35 private Mock outputConsumerMock;
36
37 protected void setUp()
38 throws Exception
39 {
40 super.setUp();
41 setOutputConsumerMock( new Mock( OutputConsumer.class ) );
42 setOutputConsumer( new OutputConsumerProxy( (OutputConsumer) getOutputConsumerMock().proxy() ) );
43 }
44
45 public void setOutputConsumerMock( Mock outputConsumerMock )
46 {
47 this.outputConsumerMock = outputConsumerMock;
48 }
49
50 public Mock getOutputConsumerMock()
51 {
52 return outputConsumerMock;
53 }
54
55 public void testConsumeFooterLine()
56 {
57 getOutputConsumerMock().expects( new InvokeOnceMatcher() ).method( "testSetStarting" )
58 .with( new IsEqual( getReportEntry() ) );
59 getOutputConsumerMock().expects( new InvokeOnceMatcher() ).method( "consumeFooterLine" )
60 .with( new IsEqual( getLine() ) );
61 getOutputConsumerMock().expects( new InvokeOnceMatcher() ).method( "testSetCompleted" );
62 super.testConsumeFooterLine();
63 getOutputConsumerMock().verify();
64 }
65
66 public void testConsumeHeaderLine()
67 {
68 getOutputConsumerMock().expects( new InvokeOnceMatcher() ).method( "testSetStarting" )
69 .with( new IsEqual( getReportEntry() ) );
70 getOutputConsumerMock().expects( new InvokeOnceMatcher() ).method( "consumeHeaderLine" )
71 .with( new IsEqual( getLine() ) );
72 getOutputConsumerMock().expects( new InvokeOnceMatcher() ).method( "testSetCompleted" );
73 super.testConsumeHeaderLine();
74 getOutputConsumerMock().verify();
75 }
76
77 public void testConsumeMessageLine()
78 {
79 getOutputConsumerMock().expects( new InvokeOnceMatcher() ).method( "testSetStarting" )
80 .with( new IsEqual( getReportEntry() ) );
81 getOutputConsumerMock().expects( new InvokeOnceMatcher() ).method( "consumeMessageLine" )
82 .with( new IsEqual( getLine() ) );
83 getOutputConsumerMock().expects( new InvokeOnceMatcher() ).method( "testSetCompleted" );
84 super.testConsumeMessageLine();
85 getOutputConsumerMock().verify();
86 }
87
88 public void testConsumeOutputLine()
89 throws Exception
90 {
91 getOutputConsumerMock().expects( new InvokeOnceMatcher() ).method( "testSetStarting" )
92 .with( new IsEqual( getReportEntry() ) );
93 getOutputConsumerMock().expects( new InvokeOnceMatcher() ).method( "consumeOutputLine" )
94 .with( new IsEqual( getLine() ) );
95 getOutputConsumerMock().expects( new InvokeOnceMatcher() ).method( "testSetCompleted" );
96 super.testConsumeOutputLine();
97 getOutputConsumerMock().verify();
98 }
99
100 public void testTestSetStarting()
101 {
102 getOutputConsumerMock().expects( new InvokeOnceMatcher() ).method( "testSetStarting" )
103 .with( new IsEqual( getReportEntry() ) );
104 super.testTestSetStarting();
105 getOutputConsumerMock().verify();
106 }
107
108 public void testTestSetCompleted()
109 {
110 getOutputConsumerMock().expects( new InvokeOnceMatcher() ).method( "testSetStarting" )
111 .with( new IsEqual( getReportEntry() ) );
112 getOutputConsumerMock().expects( new InvokeOnceMatcher() ).method( "testSetCompleted" );
113 super.testTestSetCompleted();
114 getOutputConsumerMock().verify();
115 }
116
117 }