Clover Coverage Report - EasyMock 3.0
Coverage timestamp: sam. mai 8 2010 14:37:27 CEST
206   394   56   9,81
0   348   0,27   21
21     2,67  
1    
 
  UsageExpectAndThrowTest       Line # 28 206 0% 56 35 84,6% 0.845815
 
  (40)
 
1    /**
2    * Copyright 2001-2010 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.apache.org/licenses/LICENSE-2.0
9    *
10    * Unless required by applicable law or agreed to in writing, software
11    * distributed under the License is distributed on an "AS IS" BASIS,
12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13    * See the License for the specific language governing permissions and
14    * limitations under the License.
15    */
16   
17    package org.easymock.tests;
18   
19    import static org.easymock.EasyMock.*;
20    import static org.junit.Assert.*;
21   
22    import org.junit.Before;
23    import org.junit.Test;
24   
25    /**
26    * @author OFFIS, Tammo Freese
27    */
 
28    public class UsageExpectAndThrowTest {
29   
30    private IMethods mock;
31   
32    private static RuntimeException EXCEPTION = new RuntimeException();
33   
 
34  40 toggle @Before
35    public void setup() {
36  40 mock = createMock(IMethods.class);
37    }
38   
 
39  2 toggle @Test
40    public void booleanType() {
41  2 expect(mock.booleanReturningMethod(4)).andThrow(EXCEPTION);
42  2 replay(mock);
43  2 try {
44  2 mock.booleanReturningMethod(4);
45  0 fail();
46    } catch (final RuntimeException exception) {
47  2 assertSame(EXCEPTION, exception);
48    }
49  2 verify(mock);
50    }
51   
 
52  2 toggle @Test
53    public void longType() {
54  2 expect(mock.longReturningMethod(4)).andThrow(EXCEPTION);
55  2 replay(mock);
56  2 try {
57  2 mock.longReturningMethod(4);
58  0 fail();
59    } catch (final RuntimeException exception) {
60  2 assertSame(EXCEPTION, exception);
61    }
62  2 verify(mock);
63    }
64   
 
65  2 toggle @Test
66    public void floatType() {
67  2 expect(mock.floatReturningMethod(4)).andThrow(EXCEPTION);
68  2 replay(mock);
69  2 try {
70  2 mock.floatReturningMethod(4);
71  0 fail();
72    } catch (final RuntimeException exception) {
73  2 assertSame(EXCEPTION, exception);
74    }
75  2 verify(mock);
76    }
77   
 
78  2 toggle @Test
79    public void doubleType() {
80  2 expect(mock.doubleReturningMethod(4)).andThrow(EXCEPTION);
81  2 replay(mock);
82  2 try {
83  2 mock.doubleReturningMethod(4);
84  0 fail();
85    } catch (final RuntimeException exception) {
86  2 assertSame(EXCEPTION, exception);
87    }
88  2 verify(mock);
89    }
90   
 
91  2 toggle @Test
92    public void object() {
93  2 expect(mock.objectReturningMethod(4)).andThrow(EXCEPTION);
94  2 replay(mock);
95  2 try {
96  2 mock.objectReturningMethod(4);
97  0 fail();
98    } catch (final RuntimeException exception) {
99  2 assertSame(EXCEPTION, exception);
100    }
101  2 verify(mock);
102    }
103   
 
104  2 toggle @Test
105    public void booleanAndRange() {
106  2 expect(mock.booleanReturningMethod(4)).andThrow(EXCEPTION).once();
107  2 replay(mock);
108  2 try {
109  2 mock.booleanReturningMethod(4);
110  0 fail();
111    } catch (final RuntimeException exception) {
112  2 assertSame(EXCEPTION, exception);
113    }
114  2 verify(mock);
115    }
116   
 
117  2 toggle @Test
118    public void longAndRange() {
119  2 expect(mock.longReturningMethod(4)).andThrow(EXCEPTION).once();
120  2 replay(mock);
121  2 try {
122  2 mock.longReturningMethod(4);
123  0 fail();
124    } catch (final RuntimeException exception) {
125  2 assertSame(EXCEPTION, exception);
126    }
127  2 verify(mock);
128    }
129   
 
130  2 toggle @Test
131    public void floatAndRange() {
132  2 expect(mock.floatReturningMethod(4)).andThrow(EXCEPTION).once();
133  2 replay(mock);
134  2 try {
135  2 mock.floatReturningMethod(4);
136  0 fail();
137    } catch (final RuntimeException exception) {
138  2 assertSame(EXCEPTION, exception);
139    }
140  2 verify(mock);
141    }
142   
 
143  2 toggle @Test
144    public void doubleAndRange() {
145  2 expect(mock.doubleReturningMethod(4)).andThrow(EXCEPTION).once();
146  2 replay(mock);
147  2 try {
148  2 mock.doubleReturningMethod(4);
149  0 fail();
150    } catch (final RuntimeException exception) {
151  2 assertSame(EXCEPTION, exception);
152    }
153  2 verify(mock);
154    }
155   
 
156  2 toggle @Test
157    public void objectAndRange() {
158  2 expect(mock.objectReturningMethod(4)).andThrow(EXCEPTION).once();
159  2 replay(mock);
160  2 try {
161  2 mock.objectReturningMethod(4);
162  0 fail();
163    } catch (final RuntimeException exception) {
164  2 assertSame(EXCEPTION, exception);
165    }
166  2 verify(mock);
167    }
168   
 
169  2 toggle @Test
170    public void booleanAndCount() {
171  2 expect(mock.booleanReturningMethod(4)).andThrow(EXCEPTION).times(2);
172  2 replay(mock);
173  2 try {
174  2 mock.booleanReturningMethod(4);
175  0 fail();
176    } catch (final RuntimeException exception) {
177  2 assertSame(EXCEPTION, exception);
178    }
179  2 try {
180  2 mock.booleanReturningMethod(4);
181  0 fail();
182    } catch (final RuntimeException exception) {
183  2 assertSame(EXCEPTION, exception);
184    }
185  2 verify(mock);
186    }
187   
 
188  2 toggle @Test
189    public void longAndCount() {
190  2 expect(mock.longReturningMethod(4)).andThrow(EXCEPTION).times(2);
191  2 replay(mock);
192  2 try {
193  2 mock.longReturningMethod(4);
194  0 fail();
195    } catch (final RuntimeException exception) {
196  2 assertSame(EXCEPTION, exception);
197    }
198  2 try {
199  2 mock.longReturningMethod(4);
200  0 fail();
201    } catch (final RuntimeException exception) {
202  2 assertSame(EXCEPTION, exception);
203    }
204  2 verify(mock);
205    }
206   
 
207  2 toggle @Test
208    public void floatAndCount() {
209  2 expect(mock.floatReturningMethod(4)).andThrow(EXCEPTION).times(2);
210  2 replay(mock);
211  2 try {
212  2 mock.floatReturningMethod(4);
213  0 fail();
214    } catch (final RuntimeException exception) {
215  2 assertSame(EXCEPTION, exception);
216    }
217  2 try {
218  2 mock.floatReturningMethod(4);
219  0 fail();
220    } catch (final RuntimeException exception) {
221  2 assertSame(EXCEPTION, exception);
222    }
223  2 verify(mock);
224    }
225   
 
226  2 toggle @Test
227    public void doubleAndCount() {
228  2 expect(mock.doubleReturningMethod(4)).andThrow(EXCEPTION).times(2);
229  2 replay(mock);
230  2 try {
231  2 mock.doubleReturningMethod(4);
232  0 fail();
233    } catch (final RuntimeException exception) {
234  2 assertSame(EXCEPTION, exception);
235    }
236  2 try {
237  2 mock.doubleReturningMethod(4);
238  0 fail();
239    } catch (final RuntimeException exception) {
240  2 assertSame(EXCEPTION, exception);
241    }
242  2 verify(mock);
243    }
244   
 
245  2 toggle @Test
246    public void objectAndCount() {
247  2 expect(mock.objectReturningMethod(4)).andThrow(EXCEPTION).times(2);
248  2 replay(mock);
249  2 try {
250  2 mock.objectReturningMethod(4);
251  0 fail();
252    } catch (final RuntimeException exception) {
253  2 assertSame(EXCEPTION, exception);
254    }
255  2 try {
256  2 mock.objectReturningMethod(4);
257  0 fail();
258    } catch (final RuntimeException exception) {
259  2 assertSame(EXCEPTION, exception);
260    }
261  2 verify(mock);
262    }
263   
 
264  2 toggle @Test
265    public void booleanAndMinMax() {
266  2 expect(mock.booleanReturningMethod(4)).andThrow(EXCEPTION).times(2, 3);
267  2 replay(mock);
268  2 try {
269  2 mock.booleanReturningMethod(4);
270  0 fail();
271    } catch (final RuntimeException exception) {
272  2 assertSame(EXCEPTION, exception);
273    }
274  2 try {
275  2 mock.booleanReturningMethod(4);
276  0 fail();
277    } catch (final RuntimeException exception) {
278  2 assertSame(EXCEPTION, exception);
279    }
280  2 verify(mock);
281  2 try {
282  2 mock.booleanReturningMethod(4);
283  0 fail();
284    } catch (final RuntimeException exception) {
285  2 assertSame(EXCEPTION, exception);
286    }
287  2 verify(mock);
288    }
289   
 
290  2 toggle @Test
291    public void longAndMinMax() {
292  2 expect(mock.longReturningMethod(4)).andThrow(EXCEPTION).times(2, 3);
293  2 replay(mock);
294  2 try {
295  2 mock.longReturningMethod(4);
296  0 fail();
297    } catch (final RuntimeException exception) {
298  2 assertSame(EXCEPTION, exception);
299    }
300  2 try {
301  2 mock.longReturningMethod(4);
302  0 fail();
303    } catch (final RuntimeException exception) {
304  2 assertSame(EXCEPTION, exception);
305    }
306  2 verify(mock);
307  2 try {
308  2 mock.longReturningMethod(4);
309  0 fail();
310    } catch (final RuntimeException exception) {
311  2 assertSame(EXCEPTION, exception);
312    }
313  2 verify(mock);
314    }
315   
 
316  2 toggle @Test
317    public void floatAndMinMax() {
318  2 expect(mock.floatReturningMethod(4)).andThrow(EXCEPTION).times(2, 3);
319  2 replay(mock);
320  2 try {
321  2 mock.floatReturningMethod(4);
322  0 fail();
323    } catch (final RuntimeException exception) {
324  2 assertSame(EXCEPTION, exception);
325    }
326  2 try {
327  2 mock.floatReturningMethod(4);
328  0 fail();
329    } catch (final RuntimeException exception) {
330  2 assertSame(EXCEPTION, exception);
331    }
332  2 verify(mock);
333  2 try {
334  2 mock.floatReturningMethod(4);
335  0 fail();
336    } catch (final RuntimeException exception) {
337  2 assertSame(EXCEPTION, exception);
338    }
339  2 verify(mock);
340    }
341   
 
342  2 toggle @Test
343    public void doubleAndMinMax() {
344  2 expect(mock.doubleReturningMethod(4)).andThrow(EXCEPTION).times(2, 3);
345  2 replay(mock);
346  2 try {
347  2 mock.doubleReturningMethod(4);
348  0 fail();
349    } catch (final RuntimeException exception) {
350  2 assertSame(EXCEPTION, exception);
351    }
352  2 try {
353  2 mock.doubleReturningMethod(4);
354  0 fail();
355    } catch (final RuntimeException exception) {
356  2 assertSame(EXCEPTION, exception);
357    }
358  2 verify(mock);
359  2 try {
360  2 mock.doubleReturningMethod(4);
361  0 fail();
362    } catch (final RuntimeException exception) {
363  2 assertSame(EXCEPTION, exception);
364    }
365  2 verify(mock);
366    }
367   
 
368  2 toggle @Test
369    public void objectAndMinMax() {
370  2 expect(mock.objectReturningMethod(4)).andThrow(EXCEPTION).times(2, 3);
371  2 replay(mock);
372  2 try {
373  2 mock.objectReturningMethod(4);
374  0 fail();
375    } catch (final RuntimeException exception) {
376  2 assertSame(EXCEPTION, exception);
377    }
378  2 try {
379  2 mock.objectReturningMethod(4);
380  0 fail();
381    } catch (final RuntimeException exception) {
382  2 assertSame(EXCEPTION, exception);
383    }
384  2 verify(mock);
385  2 try {
386  2 mock.objectReturningMethod(4);
387  0 fail();
388    } catch (final RuntimeException exception) {
389  2 assertSame(EXCEPTION, exception);
390    }
391  2 verify(mock);
392    }
393   
394    }