01: package com.mockrunner.test.web;
02:
03: import java.lang.reflect.Method;
04:
05: import com.mockrunner.mock.web.MockFunctionMapper;
06:
07: import junit.framework.TestCase;
08:
09: public class MockFunctionMapperTest extends TestCase {
10: private MockFunctionMapper mapper;
11: private Method method1;
12: private Method method2;
13: private Method method3;
14:
15: protected void setUp() throws Exception {
16: super .setUp();
17: mapper = new MockFunctionMapper();
18: method1 = this .getClass().getMethod("method1", null);
19: method2 = this .getClass().getMethod("method2", null);
20: method3 = this .getClass().getMethod("method3", null);
21: }
22:
23: public void testAddFuntion() {
24: mapper.addFunction(null, "method1", method1);
25: mapper.addFunction("myPrefix", "method2", method2);
26: mapper.addFunction(null, null, method3);
27: assertEquals(method1, mapper.resolveFunction(null, "method1"));
28: assertEquals(method2, mapper.resolveFunction("myPrefix",
29: "method2"));
30: assertEquals(method3, mapper.resolveFunction(null, null));
31: assertNull(mapper.resolveFunction(null, "method2"));
32: assertNull(mapper.resolveFunction("myPrefix", "method3"));
33: }
34:
35: public void method1() {
36:
37: }
38:
39: public void method2() {
40:
41: }
42:
43: public void method3() {
44:
45: }
46:
47: public void testDummy() {
48: }
49: }
|