news.setLink(new URI("http://www.news.com"));
news.setState(INews.State.READ);
DynamicDAO.save(feed);
UndoStack.getInstance().addOperation(new NewsStateOperation(Collections.singletonList(news), INews.State.UNREAD, false));
DynamicDAO.getDAO(INewsDAO.class).setState(Collections.singletonList(news), INews.State.UNREAD, false, false);
assertEquals(INews.State.UNREAD, news.getState());
UndoStack.getInstance().addOperation(new NewsStateOperation(Collections.singletonList(news), INews.State.READ, false));
DynamicDAO.getDAO(INewsDAO.class).setState(Collections.singletonList(news), INews.State.READ, false, false);
assertEquals(INews.State.READ, news.getState());
UndoStack.getInstance().undo();
UndoStack.getInstance().undo();
assertEquals(INews.State.READ, news.getState());
UndoStack.getInstance().addOperation(new NewsStateOperation(Collections.singletonList(news), INews.State.UNREAD, false));
DynamicDAO.getDAO(INewsDAO.class).setState(Collections.singletonList(news), INews.State.UNREAD, false, false);
assertEquals(INews.State.UNREAD, news.getState());
UndoStack.getInstance().addOperation(new NewsStateOperation(Collections.singletonList(news), INews.State.READ, false));
DynamicDAO.getDAO(INewsDAO.class).setState(Collections.singletonList(news), INews.State.READ, false, false);
assertEquals(INews.State.READ, news.getState());
UndoStack.getInstance().undo();
UndoStack.getInstance().undo();