Package org.jconfig

Source Code of org.jconfig.DefaultConfigEventTest

/*
* EventTest.java
* JUnit based test
*
* Created on 24. Juni 2004, 09:51
*/

package org.jconfig;

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

import org.jconfig.event.CategoryChangedEvent;
import org.jconfig.event.ConfigurationChangedEvent;
import org.jconfig.event.PropertyChangedEvent;
import org.jconfig.parser.DefaultConfigParser;
/**
*
* @author mecky
*/
public class DefaultConfigEventTest extends TestCase {
   
    private Configuration cfg;
   
    public DefaultConfigEventTest(java.lang.String testName) {
        super(testName);
    }
   
    protected void setUp() {
        System.setProperty("jconfig.parser", DefaultConfigParser.class.getName());
        cfg = new DefaultConfiguration("ConfigurationTest");
        assertNotNull(cfg);
    }
   
    public static Test suite() {
        TestSuite suite = new TestSuite(DefaultConfigEventTest.class);
        return suite;
    }
   
    public void testPropertyListener() {
        MockPropListener mpl = new MockPropListener();
        cfg.addPropertyListener(mpl,"test");
        cfg.setProperty("testName","testValue","test");
        PropertyChangedEvent e = mpl.getEvent();
        assertNotNull(e);       
    }
   
    public void testCategoryListener() {
        MockCatListener listener = new MockCatListener();
        cfg.addCategoryListener(listener,"test");
        cfg.setProperty("testName","testValue","test");
        CategoryChangedEvent e = listener.getCategoryChangedEvent();
        assertNotNull(e);       
    }
   
    public void testConfListener() {
        MockConfListener listener = new MockConfListener();
        cfg.addConfigurationListener(listener);
        cfg.setProperty("testName","testValue","test");
        ConfigurationChangedEvent e = listener.getConfigurationChangedEvent();
        assertNotNull(e);       
    }
}
TOP

Related Classes of org.jconfig.DefaultConfigEventTest

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.