### Question:
EMailLogic { boolean isImportantMessage(Message message) throws MessagingException { Set<String> importantAddresses = getImportantMailAddresses(); InternetAddress address = (InternetAddress) message.getFrom()[0]; return importantAddresses.contains(address.getAddress()); }  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();  }### Answer:
@Test protected void testIsImportantMessage() throws MessagingException, IOException { Message[] normalMessages = createMockMessages(10, 0); Message[] importantMessages = createMockMessages(10, 10); for (Message message : normalMessages) { assertThat(this.emailLogic.isImportantMessage(message), is(false)); } for (Message message : importantMessages) { assertThat(this.emailLogic.isImportantMessage(message), is(true)); } }