public void testAddAndRemoveMessageListener() {
DefaultMessageAreaModel buffer = new DefaultMessageAreaModel();
buffer.addPropertyChangeListener(ml1);
buffer.setMessage(new DefaultMessage("Msg"));
assertEquals(buffer, ml1.lastUpdated);
ml1.lastUpdated = null;
buffer.removePropertyChangeListener(ml1);
buffer.setMessage(new DefaultMessage("Msg1"));
assertEquals(null, ml1.lastUpdated);
buffer.addPropertyChangeListener(Messagable.MESSAGE_PROPERTY, ml1);
buffer.setMessage(new DefaultMessage("Msg"));
assertEquals(buffer, ml1.lastUpdated);
ml1.lastUpdated = null;
buffer.removePropertyChangeListener(Messagable.MESSAGE_PROPERTY, ml1);
buffer.setMessage(new DefaultMessage("Msg1"));
assertEquals(null, ml1.lastUpdated);
buffer.addPropertyChangeListener("Some Other Property", ml1);
buffer.setMessage(new DefaultMessage("Msg"));
assertEquals(null, ml1.lastUpdated);
}