KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > puppycrawl > tools > checkstyle > filters > FilterSetTest


1 package com.puppycrawl.tools.checkstyle.filters;
2
3 import junit.framework.TestCase;
4
5 /** Tests SuppressElementFilter */
6 // TODO: this test should be removed/rewritten
7
public class FilterSetTest extends TestCase
8 {
9     private CSVFilter filter;
10     
11     public void setUp()
12     {
13         filter = new CSVFilter("");
14     }
15     
16     public void testEmptyChain()
17     {
18         assertFalse("0", filter.accept(new Integer JavaDoc(0)));
19     }
20     
21     public void testOneFilter()
22     {
23         filter.addFilter(new IntMatchFilter(0));
24         assertTrue("0", filter.accept(new Integer JavaDoc(0)));
25         assertFalse("1", filter.accept(new Integer JavaDoc(1)));
26     }
27     
28     public void testMultipleFilter()
29     {
30         filter.addFilter(new IntMatchFilter(0));
31         filter.addFilter(new IntRangeFilter(0, 2));
32         assertTrue("0", filter.accept(new Integer JavaDoc(0)));
33         assertTrue("1", filter.accept(new Integer JavaDoc(1)));
34         filter.addFilter(new IntRangeFilter(3, 4));
35         assertTrue("0 is in [3,4]", filter.accept(new Integer JavaDoc(0)));
36     }
37 }
38
Popular Tags