package com.example.habitrack;

import junit.framework.TestCase;

import java.util.ArrayList;
import java.util.Calendar;

/**
 * Created by sshussai on 11/4/17.
 */

public class HabitTypeControllerTest extends TestCase {

    // Properties of a test habit type
    private String title;
    private String reason;
    private Calendar startDate;
    private ArrayList<Integer> schedule;

    // Test Habit type
    HabitType ht;

    // Function that runs before any tests
    protected void setUp(){
        this.title = "testTitle1";
        this.reason = "testReason1";
        this.startDate = Calendar.getInstance();
        this.schedule = new ArrayList<Integer>();
        this.schedule.add(Calendar.SUNDAY);
        this.schedule.add(Calendar.MONDAY);
    }

    public void testCreateHabit(){
        HabitTypeController htc = new HabitTypeController();
        htc.createNewHabitType(title, reason, startDate, schedule);
        ht = HabitTypeStateManager.getHTStateManager().getHabitType(1);
        assertEquals(title, ht.getTitle());
        assertEquals(reason, ht.getReason());
        assertTrue(startDate.equals(ht.getStartDate()));
        assertTrue(schedule.equals(ht.getSchedule()));
    }

    // Fucntion that runs after all tests
    protected void tearDown(){}


}
@@ -422,16 +422,37 @@
 Type ht;
+%0A    HabitType newht;
 %0A%0A    //
@@ -954,16 +954,21 @@
         
+this.
 ht = Hab
@@ -1051,16 +1051,21 @@
 (title, 
+this.
 ht.getTi
@@ -1101,16 +1101,21 @@
 reason, 
+this.
 ht.getRe
@@ -1155,24 +1155,29 @@
 Date.equals(
+this.
 ht.getStartD
@@ -1220,16 +1220,21 @@
 .equals(
+this.
 ht.getSc
@@ -1240,24 +1240,313 @@
 chedule()));
+%0A%0A    %7D%0A%0A    public void testDeleteHabit()%7B%0A        HabitTypeStateManager.getHTStateManager().removeHabitType(1);%0A        newht = HabitTypeStateManager.getHTStateManager().getHabitType(1);%0A        Integer test = -1;%0A        Integer retID = newht.getID();%0A        assertEquals(test, retID);
 %0A    %7D%0A%0A    

modify testcreateht(), and add testdeleteht() functions