|
1 |
| package com.agical.rmock.core.expectation; |
|
2 |
| |
|
3 |
| import com.agical.rmock.core.Expectation; |
|
4 |
| import com.agical.rmock.core.ExpectationVisitor; |
|
5 |
| import com.agical.rmock.core.Section; |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| public class ExpectationCounterVisitor implements ExpectationVisitor { |
|
13 |
| |
|
14 |
| private int count = 0; |
|
15 |
| private final int maxCount; |
|
16 |
| |
|
17 |
1
| public ExpectationCounterVisitor() {
|
|
18 |
1
| this( Integer.MAX_VALUE );
|
|
19 |
| } |
|
20 |
| |
|
21 |
2
| public ExpectationCounterVisitor(int maxCount) {
|
|
22 |
2
| super();
|
|
23 |
2
| this.maxCount = maxCount;
|
|
24 |
| } |
|
25 |
| |
|
26 |
5
| public boolean visit(Expectation expectation, boolean available) {
|
|
27 |
5
| count++;
|
|
28 |
5
| return count<maxCount;
|
|
29 |
| } |
|
30 |
| |
|
31 |
2
| public void enteredSection(Section section) {
|
|
32 |
| } |
|
33 |
| |
|
34 |
2
| public void exitedSection() {
|
|
35 |
| } |
|
36 |
| |
|
37 |
2
| public int getCount() {
|
|
38 |
2
| return count;
|
|
39 |
| } |
|
40 |
| |
|
41 |
| } |