KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > jmock > core > testsupport > MockVerifiable


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

3 package test.jmock.core.testsupport;
4
5 import junit.framework.AssertionFailedError;
6 import org.jmock.core.Verifiable;
7 import org.jmock.expectation.ExpectationCounter;
8 import org.jmock.util.Verifier;
9
10
11 public class MockVerifiable implements Verifiable
12 {
13     public ExpectationCounter verifyCalls =
14             new ExpectationCounter("verify #calls");
15     public AssertionFailedError verifyFailure;
16
17     public void setExpectedVerifyCalls( int expectedCalls ) {
18         verifyCalls.setExpected(expectedCalls);
19     }
20
21     /**
22      * @deprecated Use verifyExpectations to verify this object
23      */

24     public void verify() {
25         verifyCalls.inc();
26         if (verifyFailure != null) {
27             throw verifyFailure;
28         }
29     }
30
31     public void verifyExpectations() {
32         Verifier.verifyObject(this);
33     }
34
35 }
36
Popular Tags