Code example for PreferenceChangeEvent

Methods: getKey, getNewValue, getNode, getSource

0
        notes = "Checks exception.", 
        method = "PreferenceChangeEvent", 
        args = {java.util.prefs.Preferences.class, java.lang.String.class, java.lang.String.class}
    ) 
    public void testPreferenceChangeEventException() { 
        try { 
            event = new PreferenceChangeEvent(null, "key", "value");
            fail();
        } catch (IllegalArgumentException e) {
        } 
    } 
 
    @TestTargetNew( 
        level = TestLevel.COMPLETE, 
        notes = "", 
        method = "PreferenceChangeEvent", 
        args = {java.util.prefs.Preferences.class, java.lang.String.class, java.lang.String.class}
    ) 
    public void testConstructorNullValue() { 
        event = new PreferenceChangeEvent(Preferences.userRoot(), "key", null);
        assertEquals("key", event.getKey());