KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > jmock > core > MockDescriber


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

3 package test.jmock.core;
4
5 import java.util.List JavaDoc;
6 import org.jmock.core.InvocationMocker;
7 import org.jmock.core.Stub;
8 import org.jmock.core.Verifiable;
9 import org.jmock.expectation.ExpectationCounter;
10 import org.jmock.expectation.ExpectationList;
11 import org.jmock.expectation.ExpectationValue;
12 import org.jmock.util.Verifier;
13
14
15 public class MockDescriber implements InvocationMocker.Describer, Verifiable
16 {
17     public ExpectationCounter hasDescriptionCalls =
18             new ExpectationCounter("hasDescription #calls");
19     public boolean hasDescriptionResult = false;
20
21     public boolean hasDescription() {
22         hasDescriptionCalls.inc();
23         return hasDescriptionResult;
24     }
25
26     public ExpectationValue describeToBuf =
27             new ExpectationValue("describeTo buf");
28     public ExpectationList describeToMatchers =
29             new ExpectationList("describeTo matchers");
30     public ExpectationValue describeToStub =
31             new ExpectationValue("describeTo stub");
32     public ExpectationValue describeToName =
33             new ExpectationValue("describeTo name");
34
35     public void describeTo( StringBuffer JavaDoc buf, List JavaDoc matchers, Stub stub, String JavaDoc name ) {
36         describeToBuf.setActual(buf);
37         describeToMatchers.addActualMany(matchers.iterator());
38         describeToStub.setActual(stub);
39         describeToName.setActual(name);
40     }
41
42     public void verify() {
43         Verifier.verifyObject(this);
44     }
45 }
46
Popular Tags