Package org.jconfig.event

Examples of org.jconfig.event.PropertyChangedEvent


   
    public void testPropertyListener() {
        MockPropListener mpl = new MockPropListener();
        cfg.addPropertyListener(mpl,"test");
        cfg.setProperty("testName","testValue","test");
        PropertyChangedEvent e = mpl.getEvent();
        assertNotNull(e);       
    }
View Full Code Here


     */
    public void testPropertyListener() {
        MockPropListener mpl = new MockPropListener();
        cfg.addPropertyListener(mpl, "test");
        cfg.setProperty("testName","testValue","test");
        PropertyChangedEvent e = mpl.getEvent();
        assertNotNull(e);
        assertEquals("Expected property name incorrect.", "testName", e.getPropertyName());
        assertEquals("Expected new value incorrect.", "testValue", e.getNewValue());
        assertEquals("Expected event type not found", PropertyChangedEvent.PROPERTY_ADDED, e.getEventType());
        assertNull("Expected null, because this property was added!", e.getOldValue());
        // change the property!
        cfg.setProperty("testName","newTestValue","test");
        e = mpl.getEvent();
        assertNotNull(e);
        assertEquals("Expected property name incorrect.", "testName", e.getPropertyName());
        assertEquals("Expected new value incorrect.", "newTestValue", e.getNewValue());
        assertEquals("Expected event type not found", PropertyChangedEvent.PROPERTY_CHANGED, e.getEventType());
        assertEquals("Expected old value to be set!", "testValue", e.getOldValue());
        // delete the property!
        cfg.setProperty("testName",null,"test");
        e = mpl.getEvent();
        assertNotNull(e);
        assertEquals("Expected property name incorrect.", "testName", e.getPropertyName());
        assertNull("Expected new value incorrect.", e.getNewValue());
        assertEquals("Expected event type not found", PropertyChangedEvent.PROPERTY_REMOVED, e.getEventType());
        assertEquals("Expected old value to be set!", "newTestValue", e.getOldValue());
    }
View Full Code Here

TOP

Related Classes of org.jconfig.event.PropertyChangedEvent

Copyright © 2018 www.massapicom. 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.