1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| package org.easymock.internal; |
6 |
| |
7 |
| import java.lang.reflect.Method; |
8 |
| |
9 |
| import org.easymock.ArgumentsMatcher; |
10 |
| |
11 |
| public class ReplayState implements IMockControlState { |
12 |
| |
13 |
| private IBehavior behavior; |
14 |
| |
15 |
219
| public ReplayState(IBehavior behavior) {
|
16 |
219
| this.behavior = behavior;
|
17 |
| } |
18 |
| |
19 |
320
| public Object invoke(Object proxy, Method method, Object[] args)
|
20 |
| throws Throwable { |
21 |
320
| return behavior.addActual(new MethodCall(method, args))
|
22 |
| .returnObjectOrThrowException(); |
23 |
| } |
24 |
| |
25 |
119
| public void verify() {
|
26 |
119
| behavior.verify();
|
27 |
| } |
28 |
| |
29 |
1
| public void replay() {
|
30 |
1
| throwWrappedIllegalStateException();
|
31 |
| } |
32 |
| |
33 |
4
| public void setVoidCallable(Range count) {
|
34 |
4
| throwWrappedIllegalStateException();
|
35 |
| } |
36 |
| |
37 |
24
| public void setThrowable(Throwable throwable, Range count) {
|
38 |
24
| throwWrappedIllegalStateException();
|
39 |
| } |
40 |
| |
41 |
8
| public void setReturnValue(boolean value, Range count) {
|
42 |
8
| throwWrappedIllegalStateException();
|
43 |
| } |
44 |
| |
45 |
8
| public void setReturnValue(long value, Range count) {
|
46 |
8
| throwWrappedIllegalStateException();
|
47 |
| } |
48 |
| |
49 |
8
| public void setReturnValue(float value, Range count) {
|
50 |
8
| throwWrappedIllegalStateException();
|
51 |
| } |
52 |
| |
53 |
8
| public void setReturnValue(double value, Range count) {
|
54 |
8
| throwWrappedIllegalStateException();
|
55 |
| } |
56 |
| |
57 |
8
| public void setReturnValue(Object value, Range count) {
|
58 |
8
| throwWrappedIllegalStateException();
|
59 |
| } |
60 |
| |
61 |
1
| public void setDefaultVoidCallable() {
|
62 |
1
| throwWrappedIllegalStateException();
|
63 |
| } |
64 |
| |
65 |
1
| public void setDefaultThrowable(Throwable throwable) {
|
66 |
1
| throwWrappedIllegalStateException();
|
67 |
| } |
68 |
| |
69 |
1
| public void setDefaultReturnValue(float value) {
|
70 |
1
| throwWrappedIllegalStateException();
|
71 |
| } |
72 |
| |
73 |
1
| public void setDefaultReturnValue(boolean value) {
|
74 |
1
| throwWrappedIllegalStateException();
|
75 |
| } |
76 |
| |
77 |
1
| public void setDefaultReturnValue(long value) {
|
78 |
1
| throwWrappedIllegalStateException();
|
79 |
| } |
80 |
| |
81 |
1
| public void setDefaultReturnValue(double value) {
|
82 |
1
| throwWrappedIllegalStateException();
|
83 |
| } |
84 |
| |
85 |
1
| public void setDefaultReturnValue(Object value) {
|
86 |
1
| throwWrappedIllegalStateException();
|
87 |
| } |
88 |
| |
89 |
1
| public void setMatcher(ArgumentsMatcher matcher) {
|
90 |
1
| throwWrappedIllegalStateException();
|
91 |
| } |
92 |
| |
93 |
2
| public void setDefaultMatcher(ArgumentsMatcher matcher) {
|
94 |
2
| throwWrappedIllegalStateException();
|
95 |
| } |
96 |
| |
97 |
79
| private void throwWrappedIllegalStateException() {
|
98 |
79
| throw new RuntimeExceptionWrapper(new IllegalStateException(
|
99 |
| "This method must not be called in replay state.")); |
100 |
| } |
101 |
| } |