package seedu.ezdo.logic.parser;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static seedu.ezdo.logic.parser.DateParser.USER_DATE_OUTPUT_FORMAT;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

import org.junit.Test;

/**
 * Tests the behaviour of the date parser
 */
public class DateParserTest {

    private DateParser dateParser;

    /**
     * Checks if dates in natural language are parsed correctly
     * @throws Exception
     */
    @Test
    public void checkNaturalParsing() throws Exception {
        DateFormat expectedFormat = new SimpleDateFormat(USER_DATE_OUTPUT_FORMAT);
        Date dt = new Date();
        Calendar c = Calendar.getInstance();
        c.setTime(dt);

        dateParser = new DateParser("today");
        String expectedValue = expectedFormat.format(dt);
        assertTrue(expectedValue.equals(dateParser.value));

        dateParser = new DateParser("tomorrow");
        c.add(Calendar.DATE, 1); // add 1 day to get tomorrow's date
        dt = c.getTime();
        expectedValue = expectedFormat.format(dt);
        assertTrue(expectedValue.equals(dateParser.value));
    }

    /**
     * Checks if dates formatted in DD/MM/YYYY are parsed correctly
     */
    @Test
    public void checkFormatParsing() throws Exception {
        dateParser = new DateParser("31/12/2017 11:00");
        assertEquals(dateParser.value, "31/12/2017 11:00");

        dateParser = new DateParser("1/1/2016 12:00");
        assertEquals(dateParser.value, "01/01/2016 12:00");

        dateParser = new DateParser("15/01/2016 00:00");
        assertEquals(dateParser.value, "15/01/2016 00:00");
    }
}

@@ -798,16 +798,92 @@
 ime(dt);
+%0A        c.set(Calendar.HOUR_OF_DAY, 14);%0A        c.set(Calendar.MINUTE, 0);
 %0A%0A      
@@ -918,17 +918,47 @@
 r(%22today
-%22
+ 2pm%22);%0A        dt = c.getTime(
 );%0A     
@@ -1002,32 +1002,75 @@
 mat.format(dt);%0A
+        System.out.println(expectedValue);%0A
         assertTr
@@ -1159,16 +1159,20 @@
 tomorrow
+ 2pm
 %22);%0A    

Add time to dateParser tests