1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.springframework.richclient.command.support;
17
18 import junit.framework.TestCase;
19
20 public class MethodInvokingActionCommandExecutorTests extends TestCase {
21
22 private MethodInvokingActionCommandExecutor e = new MethodInvokingActionCommandExecutor();
23
24 private int invokeCount;
25
26 protected void setUp() throws Exception {
27 e = new MethodInvokingActionCommandExecutor();
28 e.setTargetObject(this);
29 e.setArguments(new Object[0]);
30 e.setTargetMethod("targetMethod");
31 e.afterPropertiesSet();
32 }
33
34 public void testExceuteInvokesMethod() {
35 e.execute();
36 assertEquals("Execute should have invoked targetMethod", 1, invokeCount);
37
38 e.execute();
39 assertEquals("Execute should have invoked targetMethod", 2, invokeCount);
40 }
41
42 public void targetMethod() {
43 invokeCount++;
44 }
45 }