Clover Coverage Report - EasyMock 3.0
Coverage timestamp: sam. mai 8 2010 14:37:27 CEST
10   52   3   5
0   30   0,3   2
2     1,5  
1    
 
  DependencyTest       Line # 27 10 0% 3 1 91,7% 0.9166667
 
  (4)
 
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.tests2;
18   
19    import static org.easymock.EasyMock.*;
20    import static org.junit.Assert.*;
21   
22    import org.easymock.EasyMockSupport;
23    import org.easymock.tests.IMethods;
24    import org.junit.Rule;
25    import org.junit.Test;
26   
 
27    public class DependencyTest extends EasyMockSupport {
28   
29    @Rule
30    public FilteringRule rule = new FilteringRule("net.sf.cglib", "org.objenesis");
31   
 
32  2 toggle @Test
33    public void testInterfaceMocking() {
34  2 final IMethods mock = createMock(IMethods.class);
35  2 expect(mock.booleanReturningMethod(1)).andReturn(true);
36  2 replayAll();
37  2 assertTrue(mock.booleanReturningMethod(1));
38  2 verifyAll();
39    }
40   
 
41  2 toggle @Test
42    public void testClassMocking() {
43  2 try {
44  2 final DependencyTest mock = createMock(DependencyTest.class);
45  0 fail("Should throw an exception due to a NoClassDefFoundError");
46    } catch (final RuntimeException e) {
47  2 assertEquals("Class mocking requires to have cglib and objenesis librairies in the classpath", e
48    .getMessage());
49  2 assertTrue(e.getCause() instanceof NoClassDefFoundError);
50    }
51    }
52    }