1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.betwixt.strategy.impl.propertysuppression;
18
19 import junit.framework.TestCase;
20
21 import org.apache.commons.betwixt.XMLIntrospector;
22 import org.apache.commons.betwixt.io.BeanWriter;
23
24 public class TestPackageSuppressor extends TestCase {
25
26 public void testExact() throws Exception {
27 PackageSuppressor suppressor = new PackageSuppressor("org.apache.commons.betwixt");
28 assertFalse("Unrelated class", suppressor.suppressProperty(String.class, String.class,"bogus"));
29 assertFalse("Unrelated type", suppressor.suppressProperty(XMLIntrospector.class, String.class,"bogus"));
30 assertTrue("Type in package", suppressor.suppressProperty( String.class, XMLIntrospector.class,"bogus"));
31 assertFalse("Type in child package", suppressor.suppressProperty( String.class, BeanWriter.class,"bogus"));
32 }
33
34 public void testWild() throws Exception {
35 PackageSuppressor suppressor = new PackageSuppressor("org.apache.commons.betwixt.*");
36 assertFalse("Unrelated class", suppressor.suppressProperty(String.class, String.class,"bogus"));
37 assertFalse("Unrelated type", suppressor.suppressProperty(XMLIntrospector.class, String.class,"bogus"));
38 assertTrue("Type in package", suppressor.suppressProperty( String.class, XMLIntrospector.class,"bogus"));
39 assertTrue("Type in child package", suppressor.suppressProperty( String.class, BeanWriter.class,"bogus"));
40 }
41 }