@Test public void testGetNewMessageCountNormalCase() throws MessagingException, IOException { Message[] messages1 = createMockMessages(15, 7); when(this.inboxMock.search(ArgumentMatchers.any(FlagTerm.class))).thenReturn(messages1); assertEquals(15, this.emailLogic.getNewMessageCount(false)); assertEquals(7, this.emailLogic.getNewMessageCount(true)); Message[] messages2 = createMockMessages(10, 0); when(this.inboxMock.search(ArgumentMatchers.any(FlagTerm.class))).thenReturn(messages2); assertEquals(10, this.emailLogic.getNewMessageCount(false)); assertEquals(0, this.emailLogic.getNewMessageCount(true)); Message[] messages3 = createMockMessages(10, 10); when(this.inboxMock.search(ArgumentMatchers.any(FlagTerm.class))).thenReturn(messages3); assertEquals(10, this.emailLogic.getNewMessageCount(false)); assertEquals(10, this.emailLogic.getNewMessageCount(true)); }
public int getNewMessageCount(boolean checkForImportant) { if (checkForImportant) { return getNewImportantMessages().size(); } return getNewMessages().size(); }
EMailLogic { public int getNewMessageCount(boolean checkForImportant) { if (checkForImportant) { return getNewImportantMessages().size(); } return getNewMessages().size(); } }
EMailLogic { public int getNewMessageCount(boolean checkForImportant) { if (checkForImportant) { return getNewImportantMessages().size(); } return getNewMessages().size(); }  }
EMailLogic { public int getNewMessageCount(boolean checkForImportant) { if (checkForImportant) { return getNewImportantMessages().size(); } return getNewMessages().size(); }  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 { public int getNewMessageCount(boolean checkForImportant) { if (checkForImportant) { return getNewImportantMessages().size(); } return getNewMessages().size(); }  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();  }