KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jmock > expectation > Expectation


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

3 package org.jmock.expectation;
4
5 import org.jmock.core.Verifiable;
6
7
8 /**
9  * An <EM>Expectation</EM> is an object that we set up at the beginning of a unit test to
10  * expect certain things to happen to it. If it is possible to tell, the Expectation will
11  * fail as soon as an incorrect value has been set.
12  * <p/>
13  * Call verify() at the end of a unit test to check for missing or incomplete values.
14  * <p/>
15  * If no expectations have been set on the object, then no checking will be done and
16  * verify() will do nothing.
17  */

18 public interface Expectation extends Verifiable
19 {
20
21     /**
22      * Return true if any expectations have been set on this object.
23      */

24     public boolean hasExpectations();
25
26     /**
27      * Tell the object to expect nothing to happen to it, perhaps because the test is exercising
28      * the handling of an error. The Expectation will fail if any actual values are set.
29      * <p/>
30      * Note that this is not the same as not setting any expectations, in which case verify()
31      * will do nothing.
32      */

33     void setExpectNothing();
34
35     /**
36      * If an incorrect actual value is set, defer reporting this as a failure until verify()
37      * is called on this object.
38      */

39     public void setFailOnVerify();
40 }
41
Popular Tags