1 3 package atest.jmock.cglib; 4 5 import java.util.ArrayList ; 6 import org.jmock.Mock; 7 import org.jmock.cglib.MockObjectTestCase; 8 9 10 public class MockConcreteClassAcceptanceTest extends MockObjectTestCase 11 { 12 public void testCanMockConcreteClasses() throws Exception { 13 Mock listMock = mock(ArrayList .class, "listMock"); 14 15 assertTrue("proxy is an ArrayList", listMock.proxy() instanceof ArrayList ); 16 17 ArrayList proxy = (ArrayList )listMock.proxy(); 18 Object newElement = newDummy("newElement"); 19 20 listMock.expects(once()).method("add").with(eq(newElement)).will(returnValue(true)); 21 22 proxy.add(newElement); 23 listMock.verify(); 24 } 25 } 26 | Popular Tags |