package ca.six.todo.datat;

import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.LargeTest;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

import java.util.List;

import ca.six.todo.model.Task;
import ca.six.todo.model.TaskManager;
import ca.six.util.L;

import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertTrue;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertThat;

/**
 * Created by songzhw on 2016-05-15.
 */
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ModelTest {
    private TaskManager taskMgr;

    @Before
    public void setUp(){
        taskMgr = TaskManager.getInstance(
                InstrumentationRegistry.getTargetContext()
        );
    }

    @After
    public void cleanUp(){
        L.d("clear up");
        TaskManager.clear();
    }

    @Test
    public void testPreConditions() {
        assertNotNull(taskMgr);
    }

    @Test
    public void testSize(){
        L.d("pre");
        // When I write this test, I already added 5 tasks in the db
        assertEquals(5, taskMgr.getTasks().size());
    }


}

@@ -290,62 +290,8 @@
 h;%0A%0A
-import java.util.List;%0A%0Aimport ca.six.todo.model.Task;
 %0Aimp
@@ -454,190 +454,8 @@
 ull;
-%0Aimport static junit.framework.Assert.assertTrue;%0Aimport static org.hamcrest.Matchers.is;%0Aimport static org.hamcrest.Matchers.notNullValue;%0Aimport static org.junit.Assert.assertThat;
 %0A%0A/*
@@ -1049,17 +1049,17 @@
 y added 
-5
+6
  tasks i
@@ -1088,17 +1088,17 @@
 tEquals(
-5
+6
 , taskMg
@@ -1127,10 +1127,238 @@
     %7D%0A%0A%0A
+%0A    /** JUnit is not sure about the call sequence !!! */%0A//    @Test%0A//    public void testAdd()%7B%0A//        L.d(%22222%22);%0A//        taskMgr.saveTask(%22add by test%22);%0A//        assertEquals(7, taskMgr.getTasks().size());%0A//    %7D%0A%0A%0A
 %7D%0A

add another test. But please note that Junit does not make sure the sequence of all the methods