1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.commons.proxy.interceptor.filter;
19
20 import junit.framework.TestCase;
21
22 import java.util.Date;
23
24 import org.apache.commons.proxy.interceptor.MethodFilter;
25
26
27
28
29
30 public class TestPatternFilter extends TestCase
31 {
32 public void testAccepts() throws Exception
33 {
34 final MethodFilter filter = PatternFilter.getterSetterFilter();
35 assertTrue( filter.accepts( Date.class.getMethod( "getSeconds", new Class[] {} ) ) );
36 assertTrue( filter.accepts( Date.class.getMethod( "getMinutes", new Class[] {} ) ) );
37 assertTrue( filter.accepts( Date.class.getMethod( "setSeconds", new Class[] { Integer.TYPE } ) ) );
38 assertTrue( filter.accepts( Date.class.getMethod( "setMinutes", new Class[] { Integer.TYPE } ) ) );
39 assertFalse( filter.accepts( Date.class.getMethod( "toString", new Class[] {} ) ) );
40 assertFalse( filter.accepts( Date.class.getMethod( "hashCode", new Class[] {} ) ) );
41 }
42
43
44 }