*/
@Test
public final void testOnClear() {
final String attribute = "clear";
final PerceptionToObject pto = new PerceptionToObject();
final RPObject object = new RPObject();
object.setID(new RPObject.ID(1, "zone"));
final ObjectChangeListener listener = new ObjectChangeListenerAdapter() {
@Override
public void deleted() {
object.put(attribute, "");
}
};
final RPObject object2 = new RPObject();
object2.setID(new RPObject.ID(2, "zone"));
pto.register(object, listener);
pto.register(object2, listener);
assertTrue("object is contained in map after register of listener", pto.map.containsKey(object.getID()));
assertFalse("deleted not yet called", object.has(attribute));
assertTrue(pto.map.containsKey(object2.getID()));
assertFalse(object2.has(attribute));
pto.onClear();
assertTrue(object.has(attribute));
assertFalse(object2.has(attribute));
assertFalse(pto.map.containsKey(object.getID()));
assertFalse(pto.map.containsKey(object2.getID()));
}