package edu.pdx.cs410J.erik;

import org.junit.Test;

import java.util.Date;

import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.assertThat;

/*
TODO:
Test having dates with multiple digits (i.e. 9:16 and 11:11)
Test am/pm
 */

/**
 * Unit tests for the {@link Appointment} class.
 */
public class AppointmentTest {

  public static Appointment testAppt = new Appointment("Armistice Agreement Meeting", "11/11/1918 11:11 am", "11/11/1918 12:11 pm");

  @Test
  public void getBeginTimeStringIsImplemented() {
    assertThat(testAppt.getBeginTimeString(), containsString("11/11/18"));
  }

  @Test
  public void getEndTImeStringIsImplemented() {
    assertThat(testAppt.getEndTimeString(), containsString("11/11/18"));
  }

  @Test
  public void differentAppointmentsReturnDifferentDescriptions() {
    Appointment appointment = new Appointment("Armistice Agreement Meeting", "11/11/1918 11:11 am", "11/11/1918 12:11 pm");
    Appointment appointment1 = new Appointment("Definitely Not An Armistice Agreement Meeting", "11/11/1918 11:11 am", "11/11/1918 12:11 pm");
    assertThat(appointment.getDescription(), is(not(equalTo(appointment1.getDescription()))));
  }

  @Test
  public void getBeginAndEndTimeAreImplemented() {
    assertThat(testAppt.getBeginTime(), is(not(nullValue())));
    assertThat(testAppt.getEndTime(), is(not(nullValue())));
  }
}

@@ -47,16 +47,51 @@
 .Test;%0A%0A
+import java.text.SimpleDateFormat;%0A
 import j
@@ -1285,35 +1285,37 @@
 ted() %7B%0A    
-assertThat(
+Date start = 
 testAppt.get
@@ -1321,24 +1321,84 @@
 tBeginTime()
+;%0A    Date end = testAppt.getEndTime();%0A    assertThat(start
 , is(not(nul
@@ -1425,37 +1425,19 @@
 ertThat(
-testAppt.getEndTime()
+end
 , is(not
@@ -1455,12 +1455,176 @@
 ))));%0A  
-%7D
+  assertThat(start.toString(), containsString(%22Mon Nov 11 11:11:00 PST 1918%22));%0A    assertThat(end.toString(), containsString(%22Mon Nov 11 12:11:00 PST 1918%22));%0A%0A  %7D%0A
 %0A%7D%0A

Add test for dates.