package seedu.forgetmenot.model.task;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import java.util.ArrayList;

import org.junit.Test;

//@@A0139671X
public class TimeTest {
    
    @Test
    public void isValidDate_trueIfDateFormatIsCorrect() {

        ArrayList<String> validDates = new ArrayList<String>();
        validDates.add("01/1/18");
        validDates.add("1/1/16");
        validDates.add("1/01/16");
        validDates.add("31/10/10");
        validDates.add("30/6/10");
        validDates.add("6/6/10");
        validDates.add("29/2/16");
        validDates.add("01/01/16");

        ArrayList<String> invalidDates = new ArrayList<String>();
        invalidDates.add("32/1/16"); // day out of range
        invalidDates.add("1/13/20"); // month out of range
        invalidDates.add("29/2/17"); // 2017 not a leap year
        invalidDates.add("30/2/16"); // February has max 29 days even during leap year
        invalidDates.add("31/6/16"); // June 30 days
        invalidDates.add("111/2/16"); // invalid day
        invalidDates.add("22/2/2008"); // invalid year
        invalidDates.add("29/a/20"); // invalid month

        for (int i = 0; i < validDates.size(); i++)
            assertTrue(Time.isValidDate(validDates.get(i)));

        for (int i = 0; i < invalidDates.size(); i++)
            assertFalse(Time.isValidDate(invalidDates.get(i)));
    }
    
    
}

@@ -67,115 +67,129 @@
 ert.
-assertFalse;%0Aimport static org.junit.Assert.assertTrue;%0A%0Aimport java.util.ArrayList;%0A%0Aimport org.junit.Test
+*;%0Aimport java.util.ArrayList;%0A%0Aimport org.junit.Test;%0A%0Aimport seedu.forgetmenot.commons.exceptions.IllegalValueException
 ;%0A%0A/
@@ -1429,19 +1429,588 @@
 %0A    %7D%0A    %0A
+%09@Test%0A%09public void parseTime_invalidTimes_throwsError() throws IllegalValueException %7B%0A%09%09%0A%09%09assertInvalidTime(%22tdy%22);%0A%09%09assertInvalidTime(%2246pm%22);%0A%09%09assertInvalidTime(%22invalid%22);%0A%09%09assertInvalidTime(%22abc5pm%22);%0A%09%09assertInvalidTime(%22!@#%22);%0A%09%7D%0A%0A%09private void assertInvalidTime(String time) %7B%0A%09%09try %7B%0A%09%09%09Time checkTime = new Time(time);%0A%09%09%09System.out.println(%22Able to print correct time%22 + checkTime.easyReadDateFormatForUI());%0A%09%09%09fail(%22didn't throw exception%22);%0A%09%09%7D catch (IllegalValueException e) %7B%0A%09%09%09assertEquals(e.getMessage(), Time.MESSAGE_TIME_CONSTRAINTS);%0A%09%09%7D%0A%09%7D%0A
     %0A%7D%0A

Fix time test