Clover Coverage Report - EasyMock 2.4
Coverage timestamp: mer. juil. 2 2008 02:17:38 CEST
18   66   7   4,5
0   54   0,39   4
4     1,75  
1    
 
 
  RecordStateInvalidStateChangeTest       Line # 15 18 7 86,4% 0.8636364
 
  (3)
 
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.easymock.internal.RecordState;
11    import org.junit.Before;
12    import org.junit.Test;
13   
14    @SuppressWarnings("deprecation")
 
15    public class RecordStateInvalidStateChangeTest {
16    MockControl<IMethods> control;
17   
18    IMethods mock;
19   
 
20  3 toggle @Before
21    public void setup() {
22  3 control = MockControl.createControl(IMethods.class);
23  3 mock = control.getMock();
24    }
25   
 
26  1 toggle @Test
27    public void activateWithoutReturnValue() {
28  1 mock.oneArg(false);
29  1 try {
30  1 control.replay();
31  0 fail("IllegalStateException expected");
32    } catch (IllegalStateException e) {
33  1 assertEquals(
34    "missing behavior definition for the preceeding method call oneArg(false)",
35    e.getMessage());
36  1 assertTrue("stack trace must be cut", Util.getStackTrace(e)
37    .indexOf(RecordState.class.getName()) == -1);
38    }
39    }
40   
 
41  1 toggle @Test
42    public void secondCallWithoutReturnValue() {
43  1 mock.oneArg(false);
44  1 try {
45  1 mock.oneArg(false);
46  0 fail("IllegalStateException expected");
47    } catch (IllegalStateException e) {
48  1 assertEquals(
49    "missing behavior definition for the preceeding method call oneArg(false)",
50    e.getMessage());
51  1 assertTrue("stack trace must be cut", Util.getStackTrace(e)
52    .indexOf(RecordState.class.getName()) == -1);
53    }
54    }
55   
 
56  1 toggle @Test
57    public void verifyWithoutActivation() {
58  1 try {
59  1 control.verify();
60  0 fail("IllegalStateException expected");
61    } catch (IllegalStateException e) {
62  1 assertEquals("calling verify is not allowed in record state", e
63    .getMessage());
64    }
65    }
66    }