|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
CallOnceMatcher.java | - | 100% | 100% | 100% |
|
1 |
/* Copyright (c) 2000-2003, jMock.org. See bundled LICENSE.txt */
|
|
2 |
package org.jmock.matcher;
|
|
3 |
|
|
4 |
import junit.framework.Assert;
|
|
5 |
import org.jmock.InvocationMatcher;
|
|
6 |
import org.jmock.dynamic.Invocation;
|
|
7 |
|
|
8 |
public class CallOnceMatcher implements InvocationMatcher { |
|
9 |
private boolean wasInvoked = false; |
|
10 |
|
|
11 | 28 |
public boolean matches(Invocation invocation) { |
12 | 28 |
return !wasInvoked;
|
13 |
} |
|
14 |
|
|
15 | 22 |
public void invoked(Invocation invocation) { |
16 | 22 |
wasInvoked = true;
|
17 |
} |
|
18 |
|
|
19 | 22 |
public void verify() { |
20 | 22 |
Assert.assertTrue("Should have been invoked", wasInvoked);
|
21 |
} |
|
22 |
|
|
23 |
} |
|
24 |
|
|