Package org.jzonic.jlo.filter

Source Code of org.jzonic.jlo.filter.TextFilterTest

/*
* TextFilterTest.java
* JUnit based test
*
* Created on 31. August 2003, 22:48
*/

package org.jzonic.jlo.filter;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

import java.util.HashMap;
import java.util.Map;
/**
*
* @author Administrator
*/
public class TextFilterTest extends TestCase {
   
    public TextFilterTest(java.lang.String testName) {
        super(testName);
    }
   
    public static void main(java.lang.String[] args) {
        junit.textui.TestRunner.run(suite());
    }
   
    public static Test suite() {
        TestSuite suite = new TestSuite(TextFilterTest.class);
        return suite;
    }
   
    public void testFilter() {
        LogFilter textFilter = new TextFilter();
        Map params = new HashMap();
        params.put("expression","exception");
        textFilter.setParameters(params);
        String text = "This is an exception";
        boolean match = textFilter.match(text);
        assertEquals(true, match);
        text = "no word matches";
        match = textFilter.match(text);
        assertEquals(false, match);
        text = "no EXCEption matches";
        match = textFilter.match(text);
        assertEquals(true, match);
    }
   
   
}
TOP

Related Classes of org.jzonic.jlo.filter.TextFilterTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.