NewsListener newsListener = new NewsAdapter() {
@Override
public void entitiesUpdated(Set<NewsEvent> events) {
assertEquals(1, events.size());
NewsEvent event = events.iterator().next();
assertEquals(true, event.getEntity().equals(savedNews));
assertEquals(State.UNREAD, event.getOldNews().getState());
assertEquals(State.UNREAD, event.getEntity().getState());
}
};
DynamicDAO.addEntityListener(INews.class, newsListener);
try {
feed = DynamicDAO.save(feed);
} finally {
DynamicDAO.removeEntityListener(INews.class, newsListener);
}
newsListener = new NewsAdapter() {
@Override
public void entitiesUpdated(Set<NewsEvent> events) {
assertEquals(1, events.size());
NewsEvent event = events.iterator().next();
assertEquals(savedNews.getId(), event.getEntity().getId());
assertEquals(State.UNREAD, event.getOldNews().getState());
assertEquals(State.UPDATED, event.getEntity().getState());
}
};
DynamicDAO.addEntityListener(INews.class, newsListener);
feed.getNews().get(0).setState(State.UPDATED);
try {