package bakatxt.test;

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

import org.junit.Before;
import org.junit.Test;

import bakatxt.core.Task;

public class TaskTest {

    Task task;

    @Before
    public void setUp() throws Exception {
        task = new Task("New Task");
    }

    @Test
    public void testTaskOutput() {
        task.setDate("2014-05-02");
        task.setTime("2230");
        task.setDone(true);
        String expected = "\t[TITLE] New Task \n" + "\t[DATE] 2014-05-02 \n"
                + "\t[TIME] 2230 \n" + "\t[VENUE] null \n"
                + "\t[DESCRIPTION] null \n" + "\t[DONE] true \n"
                + "\t[FLOATING] false \n\n";
        String output = task.toDisplayString();
        System.out.println(output);
        assertEquals(expected, output);
    }

    @Test
    public void testTaskFileOutput() {
        task.setDate("2014-05-02");
        task.setTime("2230");
        task.setDone(true);
        task.setFloating(true);
        task.setDeleted(true);

        String output = task.toString();
        String expected = "[9999 5000 0000 null null] [TITLE] New Task "
                + "[DATE] null [TIME] null [VENUE] null "
                + "[DONE] true [FLOATING] true " + "[DELETED] true "
                + "[DESCRIPTION] null ";
        System.out.println(output);
        assertEquals(expected, output);
    }

    @Test
    public void testTaskFromDatabaseString() {
        String databaseStr = "[9999 5000 2014-05-02 2230] [TITLE] New Task [DATE] 2014-05-02 [TIME] 2230 [VENUE] null [DONE] true [FLOATING] false [DELETED] true [DESCRIPTION] null ";
        Task task = new Task(databaseStr);
        assertTrue(task.isDone());
        assertFalse(task.isFloating());
        assertEquals("null", task.getVenue());
        assertEquals(databaseStr, task.toString());
    }
}
@@ -345,16 +345,41 @@
 ew Task(
+);%0A        task.setTitle(
 %22New Tas
@@ -379,24 +379,24 @@
 New Task%22);%0A
-
     %7D%0A%0A    @
@@ -822,32 +822,35 @@
 tring();%0A       
+ //
  System.out.prin
@@ -1405,16 +1405,19 @@
 %0A       
+ //
  System.
@@ -1886,24 +1886,24 @@
 etVenue());%0A
-
         asse
@@ -1947,10 +1947,575 @@
 );%0A    %7D
+%0A%0A    // This is an equivalence partition test case for task creation%0A    @Test%0A    public void testInvalidDatabaseString() %7B%0A        String fake = %22%5BTITLE%5D fakeee%22;%0A        Task task = new Task(fake);%0A        assertEquals(null, task.getTitle());%0A        String real = %22%5B9999 5000 0000 null null%5D %5BTITLE%5D New Task %22%0A                + %22%5BDATE%5D null %5BTIME%5D null %5BVENUE%5D null %22%0A                + %22%5BDONE%5D true %5BFLOATING%5D true %22 + %22%5BDELETED%5D true %22%0A                + %22%5BDESCRIPTION%5D null %22;%0A        task = new Task(real);%0A        assertEquals(task.toString(), real);%0A    %7D
 %0A%7D

Add more test cases to attempt test heuristics