@Test void testnewMesagesImportant() { Map<String, EntityData> map = new HashMap<>(); when(this.important.getString()).thenReturn("important"); when(this.emailLogic.hasNewMessages(true)).thenReturn(true); map.put("important", this.important); assertThat(this.speech.newMessages(map), equalTo("You have new important messages.")); when(this.emailLogic.hasNewMessages(true)).thenReturn(false); assertThat(this.speech.newMessages(map), equalTo("No important new messages")); }
@Intent() public String newMessages(Map<String, EntityData> entities) { try { if (entities.get(IMPORTANT) != null && entities.get(IMPORTANT).getString().contains(IMPORTANT)) { if (this.logic.hasNewMessages(true)) { return "You have new important messages."; } return NO_IMP_MAILS; } if (this.logic.hasNewMessages(false)) { return "You have new messages."; } } catch (IllegalStateException ise) { return ise.getMessage(); } return NO_MAILS; }
EMailSpeech { @Intent() public String newMessages(Map<String, EntityData> entities) { try { if (entities.get(IMPORTANT) != null && entities.get(IMPORTANT).getString().contains(IMPORTANT)) { if (this.logic.hasNewMessages(true)) { return "You have new important messages."; } return NO_IMP_MAILS; } if (this.logic.hasNewMessages(false)) { return "You have new messages."; } } catch (IllegalStateException ise) { return ise.getMessage(); } return NO_MAILS; } }
EMailSpeech { @Intent() public String newMessages(Map<String, EntityData> entities) { try { if (entities.get(IMPORTANT) != null && entities.get(IMPORTANT).getString().contains(IMPORTANT)) { if (this.logic.hasNewMessages(true)) { return "You have new important messages."; } return NO_IMP_MAILS; } if (this.logic.hasNewMessages(false)) { return "You have new messages."; } } catch (IllegalStateException ise) { return ise.getMessage(); } return NO_MAILS; }  }
EMailSpeech { @Intent() public String newMessages(Map<String, EntityData> entities) { try { if (entities.get(IMPORTANT) != null && entities.get(IMPORTANT).getString().contains(IMPORTANT)) { if (this.logic.hasNewMessages(true)) { return "You have new important messages."; } return NO_IMP_MAILS; } if (this.logic.hasNewMessages(false)) { return "You have new messages."; } } catch (IllegalStateException ise) { return ise.getMessage(); } return NO_MAILS; }  @Intent String connectToAmyMail(Map<String, EntityData> entities); @Intent String disconnect(Map<String, EntityData> entities); @Intent() String newMessages(Map<String, EntityData> entities); @Intent() String numberOfNewMails(Map<String, EntityData> entities); @Intent() String readRecentMails(Map<String, EntityData> entities); }
EMailSpeech { @Intent() public String newMessages(Map<String, EntityData> entities) { try { if (entities.get(IMPORTANT) != null && entities.get(IMPORTANT).getString().contains(IMPORTANT)) { if (this.logic.hasNewMessages(true)) { return "You have new important messages."; } return NO_IMP_MAILS; } if (this.logic.hasNewMessages(false)) { return "You have new messages."; } } catch (IllegalStateException ise) { return ise.getMessage(); } return NO_MAILS; }  @Intent String connectToAmyMail(Map<String, EntityData> entities); @Intent String disconnect(Map<String, EntityData> entities); @Intent() String newMessages(Map<String, EntityData> entities); @Intent() String numberOfNewMails(Map<String, EntityData> entities); @Intent() String readRecentMails(Map<String, EntityData> entities);  }