KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > jmock > core > stub > CustomStubTest


1 /* Copyright (c) 2000-2004 jMock.org
2  */

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 JavaDoc description ) {
15             super(description);
16         }
17
18         public Object JavaDoc invoke( Invocation invocation ) throws Throwable JavaDoc {
19             return null;
20         }
21     }
22
23     public void testWritesDescriptionToStringBuffer() {
24         String JavaDoc description = "DESCRIPTION";
25         CustomStub sideEffect = new ConcreteSideEffect(description);
26
27         StringBuffer JavaDoc buf = new StringBuffer JavaDoc();
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