KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > jmock > builder > testsupport > MockBuilderIdentityTable


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

3 package test.jmock.builder.testsupport;
4
5 import junit.framework.AssertionFailedError;
6 import org.jmock.builder.BuilderNamespace;
7 import org.jmock.builder.MatchBuilder;
8 import org.jmock.core.Verifiable;
9 import org.jmock.expectation.ExpectationValue;
10 import org.jmock.util.Verifier;
11
12
13 public class MockBuilderIdentityTable
14         implements BuilderNamespace, Verifiable
15 {
16     public ExpectationValue lookupID = new ExpectationValue("lookupID id");
17     public MatchBuilder lookupIDResult;
18     public AssertionFailedError lookupIDError;
19
20     public MatchBuilder lookupID( String JavaDoc id ) {
21         lookupID.setActual(id);
22         if (lookupIDError != null) {
23             throw lookupIDError;
24         }
25         return lookupIDResult;
26     }
27
28     public ExpectationValue registerUniqueID =
29             new ExpectationValue("registerUniqueID id");
30     public ExpectationValue registerUniqueIDBuilder =
31             new ExpectationValue("registerUniqueID builder");
32
33     public void registerUniqueID( String JavaDoc id, MatchBuilder builder ) {
34         registerUniqueID.setActual(id);
35         registerUniqueIDBuilder.setActual(builder);
36     }
37
38     public ExpectationValue registerMethodName =
39             new ExpectationValue("registerMethodName name");
40     public ExpectationValue registerMethodNameBuilder =
41             new ExpectationValue("registerMethodName builder");
42
43     public void registerMethodName( String JavaDoc name, MatchBuilder builder ) {
44         registerMethodName.setActual(name);
45         registerMethodNameBuilder.setActual(builder);
46     }
47
48     public void verify() {
49         Verifier.verifyObject(this);
50     }
51 }
52
Popular Tags