package seedu.ezdo.model.task;

import java.text.ParseException;

import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.mockito.BDDMockito;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;

import seedu.ezdo.commons.exceptions.DateException;
import seedu.ezdo.commons.util.DateUtil;
import seedu.ezdo.model.ModelManager;
import seedu.ezdo.model.todo.ReadOnlyTask;
import seedu.ezdo.testutil.TaskBuilder;

@RunWith(PowerMockRunner.class)
@PrepareForTest(DateUtil.class)
public class ModelManagerTest {

    private ModelManager modelManager;

    @Rule
    public ExpectedException thrown = ExpectedException.none();

    @Before
    public void setUp() {
        modelManager = new ModelManager();
    }

    @Test
    public void checkDate_parseFail() throws Exception {
        ReadOnlyTask task = new TaskBuilder().build();
        PowerMockito.mockStatic(DateUtil.class);
        BDDMockito.given(DateUtil.isTaskDateValid(task))
                .willThrow(new ParseException("parse fail", 0));
        thrown.expect(DateException.class);
        modelManager.checkTaskDate(task);
    }

}

@@ -25,16 +25,84 @@
 .task;%0A%0A
+import static seedu.ezdo.commons.util.DateUtil.compareDateStrings;%0A%0A
 import j
@@ -1372,10 +1372,247 @@
 %0A    %7D%0A%0A
+    @Test(expected = AssertionError.class)%0A    public void compareDate_parseFail() %7B%0A        String dateStringOne = %2212345%22;%0A        String dateStringTwo = %2211/11/2016%22;%0A%0A        compareDateStrings(dateStringOne, dateStringTwo);%0A    %7D%0A%0A%0A
 %7D%0A

Add test for compareDateStrings when called with invalid dates