@Test void testReadRecentMails() { Map<String, EntityData> map = new HashMap<>(); when(this.important.getString()).thenReturn("important"); when(this.number.getNumber()).thenReturn(1); map.put("important", this.important); map.put("number", this.number); this.speech.readRecentMails(map); verify(this.emailLogic).printMessages(1, true); map.put("important", null); this.speech.readRecentMails(map); verify(this.emailLogic).printMessages(1, false); }
@Intent() public String readRecentMails(Map<String, EntityData> entities) { boolean important = false; if (entities.get(IMPORTANT) != null) { important = entities.get(IMPORTANT).getString().contains(IMPORTANT); } try { if (entities.get("all") != null && entities.get("all").getString() != null) { return this.logic.printMessages(-1, important); } if (entities.get("number") != null) { int amount = entities.get("number").getNumber(); return this.logic.printMessages(amount, important); } } catch (IllegalStateException ise) { return ise.getMessage(); } return ""; }
EMailSpeech { @Intent() public String readRecentMails(Map<String, EntityData> entities) { boolean important = false; if (entities.get(IMPORTANT) != null) { important = entities.get(IMPORTANT).getString().contains(IMPORTANT); } try { if (entities.get("all") != null && entities.get("all").getString() != null) { return this.logic.printMessages(-1, important); } if (entities.get("number") != null) { int amount = entities.get("number").getNumber(); return this.logic.printMessages(amount, important); } } catch (IllegalStateException ise) { return ise.getMessage(); } return ""; } }
EMailSpeech { @Intent() public String readRecentMails(Map<String, EntityData> entities) { boolean important = false; if (entities.get(IMPORTANT) != null) { important = entities.get(IMPORTANT).getString().contains(IMPORTANT); } try { if (entities.get("all") != null && entities.get("all").getString() != null) { return this.logic.printMessages(-1, important); } if (entities.get("number") != null) { int amount = entities.get("number").getNumber(); return this.logic.printMessages(amount, important); } } catch (IllegalStateException ise) { return ise.getMessage(); } return ""; }  }
EMailSpeech { @Intent() public String readRecentMails(Map<String, EntityData> entities) { boolean important = false; if (entities.get(IMPORTANT) != null) { important = entities.get(IMPORTANT).getString().contains(IMPORTANT); } try { if (entities.get("all") != null && entities.get("all").getString() != null) { return this.logic.printMessages(-1, important); } if (entities.get("number") != null) { int amount = entities.get("number").getNumber(); return this.logic.printMessages(amount, important); } } catch (IllegalStateException ise) { return ise.getMessage(); } return ""; }  @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 readRecentMails(Map<String, EntityData> entities) { boolean important = false; if (entities.get(IMPORTANT) != null) { important = entities.get(IMPORTANT).getString().contains(IMPORTANT); } try { if (entities.get("all") != null && entities.get("all").getString() != null) { return this.logic.printMessages(-1, important); } if (entities.get("number") != null) { int amount = entities.get("number").getNumber(); return this.logic.printMessages(amount, important); } } catch (IllegalStateException ise) { return ise.getMessage(); } return ""; }  @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);  }