final boolean deletionEvents[] = new boolean[4];
prefListener = new PreferenceListener() {
public void entitiesAdded(Set<PreferenceEvent> events) {
assertEquals(1, events.size());
PreferenceEvent event = events.iterator().next();
String key = event.getEntity().getKey();
if (key1.equals(key))
additionEvents[0] = event.getEntity().getBoolean().booleanValue();
else if (key2.equals(key))
additionEvents[1] = event.getEntity().getInteger().intValue() == 1;
else if (key3.equals(key))
additionEvents[2] = event.getEntity().getString().equals("value");
else if (key4.equals(key))
additionEvents[3] = Arrays.equals(event.getEntity().getStrings(), new String[] { "1", "2", "3", "4" });
}
public void entitiesUpdated(Set<PreferenceEvent> events) {
assertEquals(1, events.size());
PreferenceEvent event = events.iterator().next();
String key = event.getEntity().getKey();
if (key1.equals(key))
updatedEvents[0] = !event.getEntity().getBoolean().booleanValue();
else if (key2.equals(key))
updatedEvents[1] = event.getEntity().getInteger().intValue() == 0;
else if (key3.equals(key))
updatedEvents[2] = event.getEntity().getString().equals("updated_value");
else if (key4.equals(key))
updatedEvents[3] = Arrays.equals(event.getEntity().getStrings(), new String[] { "4", "3", "2", "1" });
}
public void entitiesDeleted(Set<PreferenceEvent> events) {
assertEquals(1, events.size());
PreferenceEvent event = events.iterator().next();
String key = event.getEntity().getKey();
if (key1.equals(key))
deletionEvents[0] = true;
else if (key2.equals(key))
deletionEvents[1] = true;
else if (key3.equals(key))