Code example for AbstractPreferences

Methods: flush, get, put, putBoolean, putDouble, removeNode

0
            //expected 
        } 
    } 
 
    public void testGet() throws BackingStoreException { 
        pref.put("Value", "String");
        pref.putDouble("DoubleValue", new Double(9.10938188e-31));
        pref.putBoolean("BoolValue", true);
        pref.flush();
 
        assertEquals("String", pref.get("Value", ":"));
        assertEquals("true", pref.get("BoolValue", ":"));
        assertEquals("9.10938188E-31", pref.get("DoubleValue", null));
 
        try { 
            pref.get(null, "Exception");
            fail("NullPointerException expected");
        } catch (NullPointerException e) {
            //expected 
        } 
 
        pref.removeNode();
 
        try { 
            pref.get("DoubleValue", "Exception");
            fail("IllegalStateException expected");
        } catch (IllegalStateException e) {
            //expected 
        } 
    }