1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kew.test;
17
18 import java.util.ArrayList;
19 import java.util.Calendar;
20 import java.util.Collections;
21 import java.util.Date;
22 import java.util.List;
23
24
25
26
27
28
29
30
31 public class FakeServiceImpl implements FakeService {
32
33
34
35 public static class Invocation {
36 public long timestamp;
37 public String methodName;
38 public List<Object> arguments = new ArrayList<Object>();
39 public Object returnValue;
40 public Invocation(String methodName) {
41 this.timestamp = Calendar.getInstance().getTimeInMillis();
42 this.methodName = methodName;
43 }
44 }
45
46 private List<Invocation> invocations = Collections.synchronizedList(new ArrayList<Invocation>(0));
47
48
49
50
51 public List<Invocation> getInvocations() {
52 return invocations;
53 }
54
55
56
57
58
59
60 public void method1(Object arg1, Object arg2) {
61 Invocation i = new Invocation("method1");
62 i.arguments.add(arg1);
63 i.arguments.add(arg2);
64 invocations.add(i);
65 }
66
67
68
69
70
71
72 public Object method2(Object arg1) {
73 Invocation i = new Invocation("method2");
74 i.arguments.add(arg1);
75 i.returnValue = new Date();
76 invocations.add(i);
77 return i.returnValue;
78 }
79 }