Code example for Preferences

Methods: childrenNamesnodeparent

0
 
        Preferences child1 = pref.node("child1");
 
        pref.node("child2");
        pref.node("child3");
        child1.node("subchild1");
 
        assertSame(pref, child1.parent());
        assertEquals(3, pref.childrenNames().length);
        assertEquals("child1", pref.childrenNames()[0]);
        assertEquals(1, child1.childrenNames().length);
        assertEquals("subchild1", child1.childrenNames()[0]);
    } 
 
    public void testClear() throws BackingStoreException { 
        Preferences pref = Preferences.userNodeForPackage(Preferences.class);
        pref.put("testClearKey", "testClearValue");
        pref.put("testClearKey1", "testClearValue1");
        assertEquals("testClearValue", pref.get("testClearKey", null));
        assertEquals("testClearValue1", pref.get("testClearKey1", null));
        pref.clear();