1 15 package org.apache.hivemind.test; 16 17 import java.util.ArrayList ; 18 import java.util.List ; 19 20 import org.easymock.MockControl; 21 22 29 public class TestMockClass extends HiveMindTestCase 30 { 31 public void testMockForClass() 32 { 33 36 try 37 { 38 MockControl c = newControl(ArrayList .class); 39 List l = (List ) c.getMock(); 40 41 l.size(); 42 c.setReturnValue(5); 43 44 replayControls(); 45 46 49 assertEquals(5, l.size()); 50 51 verifyControls(); 52 } 53 catch (Error err) 54 { 55 System.err 56 .println("TestMockClass.testMockForClass() failed --- this is due to a conflict in versions of ASM between easymock and groovy."); 57 err.printStackTrace(); 58 } 59 } 60 61 64 65 public void testPlaceholder() 66 { 67 MockControlFactory f = new PlaceholderClassMockControlFactory(); 68 69 try 70 { 71 f.newControl(ArrayList .class); 72 unreachable(); 73 } 74 catch (RuntimeException ex) 75 { 76 assertEquals( 77 "Unable to instantiate EasyMock control for class java.util.ArrayList; ensure that easymockclassextension-1.1.jar and cglib-full-2.0.1.jar are on the classpath.", 78 ex.getMessage()); 79 } 80 } 81 } | Popular Tags |