01: package net.sf.mockcreator;
02:
03: import java.util.List;
04:
05: public abstract class Expectation implements IExpectation, IReturnable {
06:
07: protected String marker;
08: protected List params;
09: protected Object returnValue;
10: protected Throwable throwableValue;
11:
12: public String getMarker() {
13: return marker;
14: }
15:
16: public Object getReturnValue() {
17: return returnValue;
18: }
19:
20: public Throwable getThrowableValue() {
21: return throwableValue;
22: }
23:
24: public List getParams() {
25: return params;
26: }
27:
28: public void returns(Object o) {
29: returnValue = o;
30: }
31:
32: public void returns(char v) {
33: returnValue = new Character(v);
34: }
35:
36: public void returns(byte v) {
37: returnValue = new Byte(v);
38: }
39:
40: public void returns(short v) {
41: returnValue = new Short(v);
42: }
43:
44: public void returns(int v) {
45: returnValue = new Integer(v);
46: }
47:
48: public void returns(long v) {
49: returnValue = new Long(v);
50: }
51:
52: public void returns(float v) {
53: returnValue = new Float(v);
54: }
55:
56: public void returns(double v) {
57: returnValue = new Double(v);
58: }
59:
60: public void returns(boolean v) {
61: returnValue = new Boolean(v);
62: }
63:
64: public void throwable(Throwable th) {
65: if (th == null)
66: throw new IllegalArgumentException(
67: "pass an non-null exception here, okay?");
68: throwableValue = th;
69: }
70:
71: public int hashCode() {
72: return getMarker().hashCode();
73: }
74:
75: public String toString() {
76: return "<" + getClass() + "@" + getMarker() + ":" + getParams()
77: + "=" + getReturnValue() + ">";
78: }
79: }
|