// Save
final InputStream data = fromString(getMockEmail(from, to, subject, content));
Observer mockObserver = new Observer() {
@Override
public void update(Observable o, Object arg) {
EmailModel model = (EmailModel)arg;
assertEquals(from, model.getFrom());
assertEquals(to, model.getTo());
assertEquals(subject, model.getSubject());
assertEquals(to, model.getTo());
assertNotNull(model.getEmailStr());
assertFalse(model.getEmailStr().isEmpty());
assertNotNull(model.getFilePath());
assertFalse(model.getFilePath().isEmpty());
File file = new File(model.getFilePath());
assertTrue(file.exists());
// Delete
UIModel.INSTANCE.getListMailsMap().put(0, model.getFilePath());
saver.deleteEmails();
assertFalse(file.exists());
}
};
saver.addObserver(mockObserver);