1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package th.co.edge.jseq;
24
25 import junit.framework.Test;
26 import junit.framework.TestCase;
27 import junit.framework.TestSuite;
28
29 public class ClassExclusionFilterTest extends TestCase {
30 private Activation foobarBaz = new Activation(null, "foo.bar",
31 new TestMethodImpl("Baz"), -1);
32 private Activation foobarFrotz = new Activation(null, "foo.bar",
33 new TestMethodImpl("Frotz"), -1);
34 private Activation foobazBaz = new Activation(null, "foo.baz",
35 new TestMethodImpl("Baz"), -1);
36
37 public ClassExclusionFilterTest(String name) {
38 super(name);
39 }
40
41 public static Test suite() {
42 TestSuite suite = new TestSuite(ClassExclusionFilterTest.class);
43 return suite;
44 }
45
46
47
48
49
50 public void testExactMatch() {
51 ClassExclusionFilter filter = new ClassExclusionFilter("foo.bar.Baz");
52 assertTrue("foo.bar.Baz should not be accepted", !filter
53 .accept(foobarBaz));
54 assertTrue("foo.bar.Frotz should be accepted", filter
55 .accept(foobarFrotz));
56 }
57
58 public void testPrefixMatch() {
59 ClassExclusionFilter filter = new ClassExclusionFilter("foo.bar.*");
60 assertTrue("foo.bar.Baz should not be accepted", !filter
61 .accept(foobarBaz));
62 assertTrue("foo.baz.Baz should be accepted", filter.accept(foobazBaz));
63 }
64
65 public void testSuffixMatch() {
66 ClassExclusionFilter filter = new ClassExclusionFilter("*.Baz");
67 assertTrue("foo.bar.Baz should not be accepted", !filter
68 .accept(foobarBaz));
69 assertTrue("foo.bar.Frotz should be accepted", filter
70 .accept(foobarFrotz));
71 }
72
73 public void testEverythingMatch() {
74 ClassExclusionFilter filter = new ClassExclusionFilter("*");
75 assertTrue("foo.bar.Baz should not be accepted", !filter
76 .accept(foobarBaz));
77 assertTrue("foo.baz.Baz should not be accepted", !filter
78 .accept(foobazBaz));
79 assertTrue("foo.bar.Frotz should not be accepted", !filter
80 .accept(foobarFrotz));
81 }
82 }