KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > easymock > internal > ReplayState


1 /*
2  * Copyright (c) 2001-2005 OFFIS. This program is made available under the terms of
3  * the MIT License.
4  */

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