// Path: cloud/src/main/java/de/rainu/alexa/cloud/calendar/exception/CalendarReadException.java
// public class CalendarReadException extends AlexaExcpetion {
//   private static final String ERROR_MESSAGE_KEY = "event.error.read";
// 
//   public CalendarReadException(String message) {
//     super(ERROR_MESSAGE_KEY, message);
//   }
// 
//   public CalendarReadException(String message, Throwable cause) {
//     super(ERROR_MESSAGE_KEY, message, cause);
//   }
// }
// 
// Path: cloud/src/main/java/de/rainu/alexa/cloud/calendar/model/Event.java
// public class Event {
//   private DateTime start;
//   private boolean startHasTime;
// 
//   private DateTime end;
//   private boolean endHasTime;
// 
//   private String summary;
//   private String description;
// 
//   public Event() {
//   }
// 
//   public Event(DateTime start) {
//     this.start = start;
//   }
// 
//   public DateTime getStart() {
//     return start;
//   }
// 
//   public void setStart(DateTime start, boolean hasTime) {
//     this.start = start;
//     this.startHasTime = hasTime;
//   }
// 
//   public DateTime getEnd() {
//     return end;
//   }
// 
//   public void setEnd(DateTime end, boolean hasTime) {
//     this.end = end;
//     this.endHasTime = hasTime;
//   }
// 
//   public boolean startHasTime() {
//     return startHasTime;
//   }
// 
//   public boolean endHasTime() {
//     return endHasTime;
//   }
// 
//   public String getSummary() {
//     return summary;
//   }
// 
//   public void setSummary(String summary) {
//     this.summary = summary;
//   }
// 
//   public String getDescription() {
//     return description;
//   }
// 
//   public void setDescription(String description) {
//     this.description = description;
//   }
// 
//   @Override
//   public boolean equals(Object o) {
//     if (this == o) {
//       return true;
//     }
//     if (!(o instanceof Event)) {
//       return false;
//     }
// 
//     Event event = (Event) o;
// 
//     if (startHasTime != event.startHasTime) {
//       return false;
//     }
//     if (endHasTime != event.endHasTime) {
//       return false;
//     }
//     if (start != null ? !start.equals(event.start) : event.start != null) {
//       return false;
//     }
//     if (end != null ? !end.equals(event.end) : event.end != null) {
//       return false;
//     }
//     if (summary != null ? !summary.equals(event.summary) : event.summary != null) {
//       return false;
//     }
//     return description != null ? description.equals(event.description) : event.description == null;
//   }
// 
//   @Override
//   public int hashCode() {
//     int result = start != null ? start.hashCode() : 0;
//     result = 31 * result + (startHasTime ? 1 : 0);
//     result = 31 * result + (end != null ? end.hashCode() : 0);
//     result = 31 * result + (endHasTime ? 1 : 0);
//     result = 31 * result + (summary != null ? summary.hashCode() : 0);
//     result = 31 * result + (description != null ? description.hashCode() : 0);
//     return result;
//   }
// 
//   @Override
//   public String toString() {
//     return "Event{" +
//         "start=" + start +
//         ", startHasTime=" + startHasTime +
//         ", end=" + end +
//         ", endHasTime=" + endHasTime +
//         ", summary='" + summary + '\'' +
//         ", description='" + description + '\'' +
//         '}';
//   }
// }


import static org.junit.Assert.assertEquals;
import com.amazon.speech.ui.OutputSpeech;
import com.amazon.speech.ui.PlainTextOutputSpeech;
import com.amazon.speech.ui.SsmlOutputSpeech;
import de.rainu.alexa.cloud.calendar.exception.CalendarReadException;
import de.rainu.alexa.cloud.calendar.model.Event;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import org.joda.time.DateTime;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.test.context.junit4.SpringRunner;

    //then
    assertEquals("<speak>Folgende Termine stehen " + moment + " an:<break time=\"500ms\"/>"
        + "Morgen: " + event.getSummary() + "</speak>", result.getSsml());
  }

  @Test
  public void readEvents_singleEventTomorrowIncludesTime() {
    //given
    final DateTime start = DateTime.now().plusDays(1);
    final Event event = new Event();
    event.setStart(start, true);
    event.setSummary("<summary>");

    final List<Event> events = Arrays.asList(event);
    final String moment = "morgen";

    //when
    final SsmlOutputSpeech result = (SsmlOutputSpeech)toTest.readEvents(aLocale, moment, events);

    //then
    assertEquals("<speak>Folgende Termine stehen " + moment + " an:<break time=\"500ms\"/>"
        + "Morgen um " + start.toString("HH:mm") + " Uhr: " + event.getSummary() + "</speak>", result.getSsml());
  }

  @Test
  public void readEvents_singleEventTomorrowDuration() {
    //given
    final DateTime start = DateTime.now().plusDays(1);
    final DateTime end = start.plusHours(1).plusMinutes(1);
// Path: cloud/src/main/java/de/rainu/alexa/cloud/calendar/exception/CalendarReadException.java
// public class CalendarReadException extends AlexaExcpetion {
//   private static final String ERROR_MESSAGE_KEY = "event.error.read";
// 
//   public CalendarReadException(String message) {
//     super(ERROR_MESSAGE_KEY, message);
//   }
// 
//   public CalendarReadException(String message, Throwable cause) {
//     super(ERROR_MESSAGE_KEY, message, cause);
//   }
// }
// 
// Path: cloud/src/main/java/de/rainu/alexa/cloud/calendar/model/Event.java
// public class Event {
//   private DateTime start;
//   private boolean startHasTime;
// 
//   private DateTime end;
//   private boolean endHasTime;
// 
//   private String summary;
//   private String description;
// 
//   public Event() {
//   }
// 
//   public Event(DateTime start) {
//     this.start = start;
//   }
// 
//   public DateTime getStart() {
//     return start;
//   }
// 
//   public void setStart(DateTime start, boolean hasTime) {
//     this.start = start;
//     this.startHasTime = hasTime;
//   }
// 
//   public DateTime getEnd() {
//     return end;
//   }
// 
//   public void setEnd(DateTime end, boolean hasTime) {
//     this.end = end;
//     this.endHasTime = hasTime;
//   }
// 
//   public boolean startHasTime() {
//     return startHasTime;
//   }
// 
//   public boolean endHasTime() {
//     return endHasTime;
//   }
// 
//   public String getSummary() {
//     return summary;
//   }
// 
//   public void setSummary(String summary) {
//     this.summary = summary;
//   }
// 
//   public String getDescription() {
//     return description;
//   }
// 
//   public void setDescription(String description) {
//     this.description = description;
//   }
// 
//   @Override
//   public boolean equals(Object o) {
//     if (this == o) {
//       return true;
//     }
//     if (!(o instanceof Event)) {
//       return false;
//     }
// 
//     Event event = (Event) o;
// 
//     if (startHasTime != event.startHasTime) {
//       return false;
//     }
//     if (endHasTime != event.endHasTime) {
//       return false;
//     }
//     if (start != null ? !start.equals(event.start) : event.start != null) {
//       return false;
//     }
//     if (end != null ? !end.equals(event.end) : event.end != null) {
//       return false;
//     }
//     if (summary != null ? !summary.equals(event.summary) : event.summary != null) {
//       return false;
//     }
//     return description != null ? description.equals(event.description) : event.description == null;
//   }
// 
//   @Override
//   public int hashCode() {
//     int result = start != null ? start.hashCode() : 0;
//     result = 31 * result + (startHasTime ? 1 : 0);
//     result = 31 * result + (end != null ? end.hashCode() : 0);
//     result = 31 * result + (endHasTime ? 1 : 0);
//     result = 31 * result + (summary != null ? summary.hashCode() : 0);
//     result = 31 * result + (description != null ? description.hashCode() : 0);
//     return result;
//   }
// 
//   @Override
//   public String toString() {
//     return "Event{" +
//         "start=" + start +
//         ", startHasTime=" + startHasTime +
//         ", end=" + end +
//         ", endHasTime=" + endHasTime +
//         ", summary='" + summary + '\'' +
//         ", description='" + description + '\'' +
//         '}';
//   }
// }


// Path: cloud/src/test/java/de/rainu/alexa/cloud/service/SpeechServiceTest.java
import static org.junit.Assert.assertEquals;
import com.amazon.speech.ui.OutputSpeech;
import com.amazon.speech.ui.PlainTextOutputSpeech;
import com.amazon.speech.ui.SsmlOutputSpeech;
import de.rainu.alexa.cloud.calendar.exception.CalendarReadException;
import de.rainu.alexa.cloud.calendar.model.Event;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import org.joda.time.DateTime;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.test.context.junit4.SpringRunner;


    //then
    assertEquals("<speak>Folgende Termine stehen " + moment + " an:<break time=\"500ms\"/>"
        + "Morgen: " + event.getSummary() + "</speak>", result.getSsml());
  }

  @Test
  public void readEvents_singleEventTomorrowIncludesTime() {
    //given
    final DateTime start = DateTime.now().plusDays(1);
    final Event event = new Event();
    event.setStart(start, true);
    event.setSummary("<summary>");

    final List<Event> events = Arrays.asList(event);
    final String moment = "morgen";

    //when
    final SsmlOutputSpeech result = (SsmlOutputSpeech)toTest.readEvents(aLocale, moment, events);

    //then
    assertEquals("<speak>Folgende Termine stehen " + moment + " an:<break time=\"500ms\"/>"
        + "Morgen um " + start.toString("HH:mm") + " Uhr: " + event.getSummary() + "</speak>", result.getSsml());
  }

  @Test
  public void readEvents_singleEventTomorrowDuration() {
    //given
    final DateTime start = DateTime.now().plusDays(1);
    final DateTime end = start.plusHours(1).plusMinutes(1);
    final Event event = new Event();