@Test void testGetEventsWithTwoEvents() { Map<String, EntityData> map = new HashMap<>(); when(this.numberEntity.getNumber()).thenReturn(2); map.put("number", this.numberEntity); when(this.logic.getEvents(2)).thenReturn(this.twoEvents); when(this.environment.getCurrentLocalDateTime()).thenReturn(LocalDateTime.of(2018, 9, 20, 10, 00)); String response = this.speech.getEvents(map); assertThat(response, equalToIgnoringWhiteSpace("You have following upcoming 2 events: Summary from 10:00 am " + "until 12:00 pm. Summary from 10:00 am until 12:00 pm.")); }
@Intent public String getEvents(Map<String, EntityData> entities) { List<CalendarEvent> events; List<String> eventList = new ArrayList<>(); int number = entities.get("number").getNumber(); LocalDateTime now = this.environment.getCurrentLocalDateTime(); events = this.logic.getEvents(number); if (events.isEmpty()) { return "No events found."; } for (CalendarEvent event : events) { eventList.add(this.checkDate(now, event, false)); } if (number == 1) { return "You have following upcoming event:\n" + String.join("\n", eventList); } return "You have following upcoming " + number + " events:\n" + String.join("\n", eventList); }
CalendarSpeech { @Intent public String getEvents(Map<String, EntityData> entities) { List<CalendarEvent> events; List<String> eventList = new ArrayList<>(); int number = entities.get("number").getNumber(); LocalDateTime now = this.environment.getCurrentLocalDateTime(); events = this.logic.getEvents(number); if (events.isEmpty()) { return "No events found."; } for (CalendarEvent event : events) { eventList.add(this.checkDate(now, event, false)); } if (number == 1) { return "You have following upcoming event:\n" + String.join("\n", eventList); } return "You have following upcoming " + number + " events:\n" + String.join("\n", eventList); } }
CalendarSpeech { @Intent public String getEvents(Map<String, EntityData> entities) { List<CalendarEvent> events; List<String> eventList = new ArrayList<>(); int number = entities.get("number").getNumber(); LocalDateTime now = this.environment.getCurrentLocalDateTime(); events = this.logic.getEvents(number); if (events.isEmpty()) { return "No events found."; } for (CalendarEvent event : events) { eventList.add(this.checkDate(now, event, false)); } if (number == 1) { return "You have following upcoming event:\n" + String.join("\n", eventList); } return "You have following upcoming " + number + " events:\n" + String.join("\n", eventList); }  }
CalendarSpeech { @Intent public String getEvents(Map<String, EntityData> entities) { List<CalendarEvent> events; List<String> eventList = new ArrayList<>(); int number = entities.get("number").getNumber(); LocalDateTime now = this.environment.getCurrentLocalDateTime(); events = this.logic.getEvents(number); if (events.isEmpty()) { return "No events found."; } for (CalendarEvent event : events) { eventList.add(this.checkDate(now, event, false)); } if (number == 1) { return "You have following upcoming event:\n" + String.join("\n", eventList); } return "You have following upcoming " + number + " events:\n" + String.join("\n", eventList); }  @Intent String getEvents(Map<String, EntityData> entities); @Intent String getEventsAt(Map<String, EntityData> entities); @Intent String setEvent(Map<String, EntityData> entities); String getDate(LocalDateTime date); static String ordinal(int i); String checkDate(LocalDateTime dayToCheck, CalendarEvent event, boolean withDate); String eventToString(LocalDateTime startDate, LocalDateTime endDate, CalendarEvent event, boolean withStartDate,
			boolean withEndDate, boolean withTime, OutputCase outputCase); String getCorrectTime(LocalDateTime localDateTime); LocalTime parseTo12Hour(LocalDateTime localDateTime); String dateOutput(LocalDateTime date, boolean withDate, boolean withTime); static OutputCase eventType(ChronoLocalDate date1, ChronoLocalDate date2, CalendarEvent event,
			OutputCase defaultCase); static boolean isAllDay(String allDayEntity); }
CalendarSpeech { @Intent public String getEvents(Map<String, EntityData> entities) { List<CalendarEvent> events; List<String> eventList = new ArrayList<>(); int number = entities.get("number").getNumber(); LocalDateTime now = this.environment.getCurrentLocalDateTime(); events = this.logic.getEvents(number); if (events.isEmpty()) { return "No events found."; } for (CalendarEvent event : events) { eventList.add(this.checkDate(now, event, false)); } if (number == 1) { return "You have following upcoming event:\n" + String.join("\n", eventList); } return "You have following upcoming " + number + " events:\n" + String.join("\n", eventList); }  @Intent String getEvents(Map<String, EntityData> entities); @Intent String getEventsAt(Map<String, EntityData> entities); @Intent String setEvent(Map<String, EntityData> entities); String getDate(LocalDateTime date); static String ordinal(int i); String checkDate(LocalDateTime dayToCheck, CalendarEvent event, boolean withDate); String eventToString(LocalDateTime startDate, LocalDateTime endDate, CalendarEvent event, boolean withStartDate,
			boolean withEndDate, boolean withTime, OutputCase outputCase); String getCorrectTime(LocalDateTime localDateTime); LocalTime parseTo12Hour(LocalDateTime localDateTime); String dateOutput(LocalDateTime date, boolean withDate, boolean withTime); static OutputCase eventType(ChronoLocalDate date1, ChronoLocalDate date2, CalendarEvent event,
			OutputCase defaultCase); static boolean isAllDay(String allDayEntity);  }