public void testRemove() throws BackingStoreException {
    assertNull(storage.toFolder());
    assertNull(storage.toPropertiesFile());

    pref.put("key", "value");
    pref.flush();
    assertNotNull(storage.toPropertiesFile());
    pref.remove("key");
    assertTrue(pref.properties.isEmpty());
    pref.flush();
    assertNull(storage.toPropertiesFile());
  }
  public void testPreferencesEvents2() throws Exception {
    pref.addNodeChangeListener(new NodeListener());
    pref.addPreferenceChangeListener(new PrefListener());

    Preferences child = pref.node("a");
    nodeAddedEvent.await();
    assertEquals("Missing node added event", 0, nodeAddedEvent.getCount());
    pref.put("key", "value");
    prefChangedEvent.await();
    assertEquals("Missing preference change event", 0, prefChangedEvent.getCount());
    pref.remove("key");
    prefRemovedEvent.await();
    assertEquals("Missing preference removed event", 0, prefRemovedEvent.getCount());
    child.removeNode();
    nodeRemovedEvent.await();
    assertEquals("Missing node removed event", 0, nodeRemovedEvent.getCount());
  }