/*
 * Copyright 2017 Max Schafer, Ammar Mahdi, Riley Dixon, Steven Weikai Lu, Jiaxiong Yang
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

package com.example.lit.saving;

import android.test.ActivityInstrumentationTestCase2;

import com.example.lit.activity.MainActivity;
import com.example.lit.exception.HabitFormatException;
import com.example.lit.habit.NormalHabit;
import com.example.lit.userprofile.UserProfile;

import org.junit.Before;

import java.util.Date;

/**
 * Created by Riley Dixon on 04/12/2017.
 */

public class DataHandlerTest extends ActivityInstrumentationTestCase2{
    private UserProfile userProfile;

    public DataHandlerTest(){
        super(MainActivity.class);
    }

    public void testSaveHabit(){
        try {
            NormalHabit habit = new NormalHabit("Test title", new Date(1), "Test reason");
            DataHandler<NormalHabit> dataHandler = null;
        } catch (HabitFormatException e) {
            e.printStackTrace();
        }
    }





}

@@ -1387,31 +1387,175 @@
 lit.
-userprofile.UserProfile
+habitevent.NormalHabitEvent;%0Aimport com.example.lit.userprofile.FollowManager;%0Aimport com.example.lit.userprofile.UserProfile;%0Aimport com.google.gson.reflect.TypeToken
 ;%0A%0Ai
@@ -1759,16 +1759,46 @@
 rProfile
+ = new UserProfile(%22unitTest%22)
 ;%0A%0A    p
@@ -2058,107 +2058,1613 @@
  = n
-ull;%0A        %7D catch (HabitFormatException e) %7B%0A            e.printStackTrace();%0A        %7D%0A    %7D%0A%0A%0A
+ew DataHandler%3C%3E(userProfile.getName(), %22Habit%22,%0A                                        getActivity(), new TypeToken%3CNormalHabit%3E()%7B%7D.getType());%0A            dataHandler.saveData(habit);%0A            NormalHabit loadedHabit = dataHandler.loadData();%0A            assertEquals(habit, loadedHabit);%0A        %7D catch (HabitFormatException e) %7B%0A            e.printStackTrace();%0A        %7D catch (NoDataException e) %7B%0A            e.printStackTrace();%0A        %7D%0A    %7D%0A%0A    public void testSaveUserProfile()%7B%0A        try %7B%0A            DataHandler%3CUserProfile%3E dh = new DataHandler%3C%3E(userProfile.getName(), %22UserProfile%22,%0A                    getActivity(), new TypeToken%3CUserProfile%3E()%7B%7D.getType());%0A%0A            dh.saveData(userProfile);%0A            UserProfile loadedProfile = dh.loadData();%0A            assertEquals(userProfile, loadedProfile);%0A%0A        %7D catch (NoDataException e) %7B%0A            e.printStackTrace();%0A        %7D%0A    %7D%0A%0A    public void testSaveHabitEvent()%7B%0A        try %7B%0A            NormalHabitEvent habitEvent = new NormalHabitEvent(%22Event name%22, %22Habit comment%22);%0A            DataHandler%3CNormalHabitEvent%3E dataHandler = new DataHandler%3C%3E(userProfile.getName(), %22UserProfile%22,%0A                    getActivity(), new TypeToken%3CNormalHabitEvent%3E() %7B%7D.getType());%0A            dataHandler.saveData(habitEvent);%0A            NormalHabitEvent loadedHabitEvent = dataHandler.loadData();%0A            assertEquals(habitEvent, loadedHabitEvent);%0A        %7D catch (HabitFormatException e) %7B%0A            e.printStackTrace();%0A        %7D catch (NoDataException e) %7B%0A            e.printStackTrace();%0A        %7D%0A    %7D
 %0A%0A%0A%7D

Make unit tests for datahandler