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.CustomStub; 8 9 10 public class CustomStubTest extends TestCase 11 { 12 static class ConcreteSideEffect extends CustomStub 13 { 14 public ConcreteSideEffect( String description ) { 15 super(description); 16 } 17 18 public Object invoke( Invocation invocation ) throws Throwable { 19 return null; 20 } 21 } 22 23 public void testWritesDescriptionToStringBuffer() { 24 String description = "DESCRIPTION"; 25 CustomStub sideEffect = new ConcreteSideEffect(description); 26 27 StringBuffer buf = new StringBuffer (); 28 29 assertSame("should return buffer", buf, sideEffect.describeTo(buf)); 30 31 assertEquals("should be description", description, buf.toString()); 32 } 33 34 } 35 | Popular Tags |