1 7 8 package org.jzonic.jlo.filter; 9 10 import junit.framework.Test; 11 import junit.framework.TestCase; 12 import junit.framework.TestSuite; 13 14 import java.util.HashMap ; 15 import java.util.Map ; 16 20 public class TextFilterTest extends TestCase { 21 22 public TextFilterTest(java.lang.String testName) { 23 super(testName); 24 } 25 26 public static void main(java.lang.String [] args) { 27 junit.textui.TestRunner.run(suite()); 28 } 29 30 public static Test suite() { 31 TestSuite suite = new TestSuite(TextFilterTest.class); 32 return suite; 33 } 34 35 public void testFilter() { 36 LogFilter textFilter = new TextFilter(); 37 Map params = new HashMap (); 38 params.put("expression","exception"); 39 textFilter.setParameters(params); 40 String text = "This is an exception"; 41 boolean match = textFilter.match(text); 42 assertEquals(true, match); 43 text = "no word matches"; 44 match = textFilter.match(text); 45 assertEquals(false, match); 46 text = "no EXCEption matches"; 47 match = textFilter.match(text); 48 assertEquals(true, match); 49 } 50 51 52 } 53 | Popular Tags |