KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mockobjects > Expectation


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

13 public interface Expectation extends Verifiable {
14
15     /**
16      * Return true if any expectations have been set on this object.
17      */

18     public boolean hasExpectations();
19
20     /**
21      * Tell the object to expect nothing to happen to it, perhaps because the test is exercising
22      * the handling of an error. The Expectation will fail if any actual values are set.
23      *
24      * Note that this is not the same as not setting any expectations, in which case verify()
25      * will do nothing.
26      */

27     void setExpectNothing();
28
29     /**
30      * If an incorrect actual value is set, defer reporting this as a failure until verify()
31      * is called on this object.
32      */

33     public void setFailOnVerify();
34 }
35
Popular Tags