Clover Coverage Report - EasyMock 3.0
Coverage timestamp: sam. mai 8 2010 14:37:27 CEST
17   75   7   4,25
0   48   0,41   4
4     1,75  
1    
 
  RecordStateInvalidStateChangeTest       Line # 29 17 0% 7 3 85,7% 0.85714287
 
  (6)
 
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.easymock.internal.RecordState;
23    import org.junit.Before;
24    import org.junit.Test;
25   
26    /**
27    * @author OFFIS, Tammo Freese
28    */
 
29    public class RecordStateInvalidStateChangeTest {
30   
31    private IMethods mock;
32   
 
33  6 toggle @Before
34    public void setup() {
35  6 mock = createMock(IMethods.class);
36    }
37   
 
38  2 toggle @Test
39    public void activateWithoutReturnValue() {
40  2 expect(mock.oneArg(false));
41  2 try {
42  2 replay(mock);
43  0 fail("IllegalStateException expected");
44    } catch (final IllegalStateException e) {
45  2 assertEquals("missing behavior definition for the preceding method call oneArg(false)", e
46    .getMessage());
47  2 assertTrue("stack trace must be cut",
48    Util.getStackTrace(e).indexOf(RecordState.class.getName()) == -1);
49    }
50    }
51   
 
52  2 toggle @Test
53    public void secondCallWithoutReturnValue() {
54  2 mock.oneArg(false);
55  2 try {
56  2 mock.oneArg(false);
57  0 fail("IllegalStateException expected");
58    } catch (final IllegalStateException e) {
59  2 assertEquals("missing behavior definition for the preceding method call oneArg(false)", e
60    .getMessage());
61  2 assertTrue("stack trace must be cut",
62    Util.getStackTrace(e).indexOf(RecordState.class.getName()) == -1);
63    }
64    }
65   
 
66  2 toggle @Test
67    public void verifyWithoutActivation() {
68  2 try {
69  2 verify(mock);
70  0 fail("IllegalStateException expected");
71    } catch (final IllegalStateException e) {
72  2 assertEquals("calling verify is not allowed in record state", e.getMessage());
73    }
74    }
75    }