@Test protected void testGetImportantMailAddresses() throws MessagingException, IOException { createMockMessages(10, 7); Set<String> importantAddresses = this.emailLogic.getImportantMailAddresses(); assertThat(importantAddresses.size(), is(7)); for (String s : importantAddresses) { assertThat(s, containsString("important")); } }
Set<String> getImportantMailAddresses() { Set<String> importantAddresses = new HashSet<>(); List<Contact> contacts = this.contactRegistry.getAll(); for (Contact c : contacts) { if (c.isImportant()) importantAddresses.add(c.getEmail()); } return importantAddresses; }
EMailLogic { Set<String> getImportantMailAddresses() { Set<String> importantAddresses = new HashSet<>(); List<Contact> contacts = this.contactRegistry.getAll(); for (Contact c : contacts) { if (c.isImportant()) importantAddresses.add(c.getEmail()); } return importantAddresses; } }
EMailLogic { Set<String> getImportantMailAddresses() { Set<String> importantAddresses = new HashSet<>(); List<Contact> contacts = this.contactRegistry.getAll(); for (Contact c : contacts) { if (c.isImportant()) importantAddresses.add(c.getEmail()); } return importantAddresses; }  }
EMailLogic { Set<String> getImportantMailAddresses() { Set<String> importantAddresses = new HashSet<>(); List<Contact> contacts = this.contactRegistry.getAll(); for (Contact c : contacts) { if (c.isImportant()) importantAddresses.add(c.getEmail()); } return importantAddresses; }  boolean hasNewMessages(boolean checkForImportant); int getNewMessageCount(boolean checkForImportant); String printMessages(int amount, boolean important); MessageDTO[] getMailsForREST(int amount); boolean connectToMailServer(EMailCredentials credentials); boolean isConnectedToMailServer(); void disconnectFromMailServer(); EMailCredentials getCredentials(); @PostConstruct void connectToMailServer(); }
EMailLogic { Set<String> getImportantMailAddresses() { Set<String> importantAddresses = new HashSet<>(); List<Contact> contacts = this.contactRegistry.getAll(); for (Contact c : contacts) { if (c.isImportant()) importantAddresses.add(c.getEmail()); } return importantAddresses; }  boolean hasNewMessages(boolean checkForImportant); int getNewMessageCount(boolean checkForImportant); String printMessages(int amount, boolean important); MessageDTO[] getMailsForREST(int amount); boolean connectToMailServer(EMailCredentials credentials); boolean isConnectedToMailServer(); void disconnectFromMailServer(); EMailCredentials getCredentials(); @PostConstruct void connectToMailServer();  }