KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jmock > core > matcher > InvokeOnceMatcher


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

3 package org.jmock.core.matcher;
4
5 import org.jmock.core.Invocation;
6
7
8 public class InvokeOnceMatcher
9         extends InvokedRecorder
10 {
11     public boolean matches( Invocation invocation ) {
12         return !hasBeenInvoked();
13     }
14
15     public void verify() {
16         verifyHasBeenInvoked();
17     }
18
19     public boolean hasDescription() {
20         return true;
21     }
22
23     public StringBuffer JavaDoc describeTo( StringBuffer JavaDoc buffer ) {
24         buffer.append("expected once");
25         if (hasBeenInvoked()) buffer.append(" and has been invoked");
26         return buffer;
27     }
28 }
29
Popular Tags