1 3 package test.jmock.core.stub; 4 5 import junit.framework.TestCase; 6 import org.jmock.core.Invocation; 7 import org.jmock.core.stub.VoidStub; 8 import test.jmock.core.testsupport.MethodFactory; 9 10 11 public class VoidStubTest 12 extends TestCase 13 { 14 Invocation invocation; 15 VoidStub voidStub; 16 17 public void setUp() { 18 MethodFactory methodFactory = new MethodFactory(); 19 invocation = new Invocation("INVOKED-OBJECT", methodFactory.newMethodReturning(void.class), new Object [0]); 20 voidStub = new VoidStub(); 21 } 22 23 public void testReturnsNullWhenInvoked() throws Throwable { 24 assertNull("Should return null", 25 new VoidStub().invoke(invocation)); 26 } 27 28 public void testIncludesVoidInDescription() { 29 StringBuffer buffer = new StringBuffer (); 30 31 voidStub.describeTo(buffer); 32 33 String description = buffer.toString(); 34 35 assertTrue("contains 'void' in description", 36 description.indexOf("void") >= 0); 37 } 38 } 39 | Popular Tags |