1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.seasar.uruma.binding.method.impl;
17
18 import junitx.framework.ArrayAssert;
19
20
21
22
23
24
25 public class OmissionArgumentsFilterTest extends
26 AbstractArgumentFilterTest<OmissionArgumentsFilter> {
27
28
29
30 public void testFilter1() throws Exception {
31 OmissionArgumentsFilter filter = createFilter("targetMethod1");
32
33 assertNull("1", filter.filter(null));
34
35
36 ArrayAssert.assertEquals("2", new Object[] {}, filter
37 .filter(new Object[] { "test" }));
38 }
39
40
41
42
43 public void testFilter2() throws Exception {
44 OmissionArgumentsFilter filter = createFilter("targetMethod2",
45 Object.class);
46
47
48 Object[] args = new Object[] { "test1" };
49 ArrayAssert.assertEquals("1", args, filter.filter(args));
50
51
52 ArrayAssert.assertEquals("2", args, filter.filter(new Object[] {
53 "test1", "test2" }));
54 }
55
56
57
58
59 public void testFilter3() throws Exception {
60 OmissionArgumentsFilter filter = createFilter("targetMethod3",
61 Object.class, Object.class);
62
63
64 Object[] args = new Object[] { "test1", "test2" };
65 ArrayAssert.assertEquals("1", args, filter.filter(args));
66
67
68 ArrayAssert.assertEquals("2", args, filter.filter(new Object[] {
69 "test1", "test2", "test3" }));
70 }
71
72
73
74
75 public void targetMethod1() {
76
77 }
78
79
80
81
82 public void targetMethod2(final Object arg1) {
83
84 }
85
86
87
88
89 public void targetMethod3(final Object arg1, final Object arg2) {
90
91 }
92
93
94
95
96 @Override
97 protected Class<OmissionArgumentsFilter> getFilterType() {
98 return OmissionArgumentsFilter.class;
99 }
100 }