Clover Coverage Report - EasyMock 2.4
Coverage timestamp: mer. juil. 2 2008 02:17:38 CEST
92   199   21   4,38
0   170   0,23   21
21     1  
1    
 
 
  UsageExpectAndReturnTest       Line # 14 92 21 100% 1.0
 
  (20)
 
1    /*
2    * Copyright (c) 2001-2008 OFFIS, Tammo Freese.
3    * This program is made available under the terms of the MIT License.
4    */
5    package org.easymock.tests;
6   
7    import static org.junit.Assert.*;
8   
9    import org.easymock.MockControl;
10    import org.junit.Before;
11    import org.junit.Test;
12   
13    @SuppressWarnings("deprecation")
 
14    public class UsageExpectAndReturnTest {
15    private MockControl<IMethods> control;
16   
17    private IMethods mock;
18   
 
19  20 toggle @Before
20    public void setup() {
21  20 control = MockControl.createControl(IMethods.class);
22  20 mock = control.getMock();
23    }
24   
 
25  1 toggle @Test
26    public void booleanType() {
27  1 control.expectAndReturn(mock.booleanReturningMethod(4), true);
28  1 control.replay();
29  1 assertEquals(true, mock.booleanReturningMethod(4));
30  1 control.verify();
31    }
32   
 
33  1 toggle @Test
34    public void longType() {
35  1 control.expectAndReturn(mock.longReturningMethod(4), 12l);
36  1 control.replay();
37  1 assertEquals((long) 12, mock.longReturningMethod(4));
38  1 control.verify();
39    }
40   
 
41  1 toggle @Test
42    public void floatType() {
43  1 control.expectAndReturn(mock.floatReturningMethod(4), 12f);
44  1 control.replay();
45  1 assertEquals(12f, mock.floatReturningMethod(4), 0f);
46  1 control.verify();
47    }
48   
 
49  1 toggle @Test
50    public void doubleType() {
51  1 control.expectAndReturn(mock.doubleReturningMethod(4), 12.0);
52  1 control.replay();
53  1 assertEquals(12.0, mock.doubleReturningMethod(4), 0.0);
54  1 control.verify();
55    }
56   
 
57  1 toggle @Test
58    public void object() {
59  1 control.expectAndReturn(mock.objectReturningMethod(4), "12");
60  1 control.replay();
61  1 assertEquals("12", mock.objectReturningMethod(4));
62  1 control.verify();
63    }
64   
 
65  1 toggle @Test
66    public void booleanAndRange() {
67  1 control.expectAndReturn(mock.booleanReturningMethod(4), true,
68    MockControl.ONE);
69  1 control.replay();
70  1 assertEquals(true, mock.booleanReturningMethod(4));
71  1 control.verify();
72    }
73   
 
74  1 toggle @Test
75    public void longAndRange() {
76  1 control.expectAndReturn(mock.longReturningMethod(4), 12l,
77    MockControl.ONE);
78  1 control.replay();
79  1 assertEquals((long) 12, mock.longReturningMethod(4));
80  1 control.verify();
81    }
82   
 
83  1 toggle @Test
84    public void floatAndRange() {
85  1 control.expectAndReturn(mock.floatReturningMethod(4), 12f,
86    MockControl.ONE);
87  1 control.replay();
88  1 assertEquals(12f, mock.floatReturningMethod(4), 0f);
89  1 control.verify();
90    }
91   
 
92  1 toggle @Test
93    public void doubleAndRange() {
94  1 control.expectAndReturn(mock.doubleReturningMethod(4), 12.0,
95    MockControl.ONE);
96  1 control.replay();
97  1 assertEquals(12.0, mock.doubleReturningMethod(4), 0.0);
98  1 control.verify();
99    }
100   
 
101  1 toggle @Test
102    public void objectAndRange() {
103  1 control.expectAndReturn(mock.objectReturningMethod(4), "12",
104    MockControl.ONE);
105  1 control.replay();
106  1 assertEquals("12", mock.objectReturningMethod(4));
107  1 control.verify();
108    }
109   
 
110  1 toggle @Test
111    public void booleanAndCount() {
112  1 control.expectAndReturn(mock.booleanReturningMethod(4), true, 2);
113  1 control.replay();
114  1 assertEquals(true, mock.booleanReturningMethod(4));
115  1 assertEquals(true, mock.booleanReturningMethod(4));
116  1 control.verify();
117    }
118   
 
119  1 toggle @Test
120    public void longAndCount() {
121  1 control.expectAndReturn(mock.longReturningMethod(4), 12l, 2);
122  1 control.replay();
123  1 assertEquals((long) 12, mock.longReturningMethod(4));
124  1 assertEquals((long) 12, mock.longReturningMethod(4));
125  1 control.verify();
126    }
127   
 
128  1 toggle @Test
129    public void floatAndCount() {
130  1 control.expectAndReturn(mock.floatReturningMethod(4), 12f, 2);
131  1 control.replay();
132  1 assertEquals(12f, mock.floatReturningMethod(4), 0f);
133  1 assertEquals(12f, mock.floatReturningMethod(4), 0f);
134  1 control.verify();
135    }
136   
 
137  1 toggle @Test
138    public void doubleAndCount() {
139  1 control.expectAndReturn(mock.doubleReturningMethod(4), 12.0, 2);
140  1 control.replay();
141  1 assertEquals(12.0, mock.doubleReturningMethod(4), 0.0);
142  1 assertEquals(12.0, mock.doubleReturningMethod(4), 0.0);
143  1 control.verify();
144    }
145   
 
146  1 toggle @Test
147    public void objectAndCount() {
148  1 control.expectAndReturn(mock.objectReturningMethod(4), "12", 2);
149  1 control.replay();
150  1 assertEquals("12", mock.objectReturningMethod(4));
151  1 assertEquals("12", mock.objectReturningMethod(4));
152  1 control.verify();
153    }
154   
 
155  1 toggle @Test
156    public void booleanAndMinMax() {
157  1 control.expectAndReturn(mock.booleanReturningMethod(4), true, 2, 3);
158  1 control.replay();
159  1 assertEquals(true, mock.booleanReturningMethod(4));
160  1 assertEquals(true, mock.booleanReturningMethod(4));
161  1 control.verify();
162    }
163   
 
164  1 toggle @Test
165    public void longAndMinMax() {
166  1 control.expectAndReturn(mock.longReturningMethod(4), 12l, 2, 3);
167  1 control.replay();
168  1 assertEquals((long) 12, mock.longReturningMethod(4));
169  1 assertEquals((long) 12, mock.longReturningMethod(4));
170  1 control.verify();
171    }
172   
 
173  1 toggle @Test
174    public void floatAndMinMax() {
175  1 control.expectAndReturn(mock.floatReturningMethod(4), 12f, 2, 3);
176  1 control.replay();
177  1 assertEquals(12f, mock.floatReturningMethod(4), 0f);
178  1 assertEquals(12f, mock.floatReturningMethod(4), 0f);
179  1 control.verify();
180    }
181   
 
182  1 toggle @Test
183    public void doubleAndMinMax() {
184  1 control.expectAndReturn(mock.doubleReturningMethod(4), 12.0, 2, 3);
185  1 control.replay();
186  1 assertEquals(12.0, mock.doubleReturningMethod(4), 0.0);
187  1 assertEquals(12.0, mock.doubleReturningMethod(4), 0.0);
188  1 control.verify();
189    }
190   
 
191  1 toggle @Test
192    public void objectAndMinMax() {
193  1 control.expectAndReturn(mock.objectReturningMethod(4), "12", 2, 3);
194  1 control.replay();
195  1 assertEquals("12", mock.objectReturningMethod(4));
196  1 assertEquals("12", mock.objectReturningMethod(4));
197  1 control.verify();
198    }
199    }