package todomore.android;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;

import java.util.List;

import org.junit.Test;

import com.darwinsys.todo.model.Priority;
import com.darwinsys.todo.model.Task;

public class GruntWorkTest {

	@Test
	public void testJsonToTaskList() {
		String input = 
				"[{\"id\":102,\"priority\":\"High\",\"name\":\"TEST 2\","
				+ "\"creationDate\":{\"year\":2015,\"month\":11,\"day\":1},"
				+ "\"project\":null,\"context\":{\"id\":100,\"name\":\"Life\"},"
				+ "\"dueDate\":null,\"status\":\"ACTIVE\",\"completedDate\":null,"
				+ "\"modified\":1448292432791,\"description\":\"None\","
				+ "\"complete\":false},"
				// Start of second Task
				+ "{\"id\":103,\"priority\":\"Low\",\"name\":\"Low prio item\","
				+ "\"creationDate\":{\"year\":2015,\"month\":10,\"day\":23},"
				+ "\"project\":null,\"context\":{\"id\":80,\"name\":\"Home\"},"
				+ "\"dueDate\":null,\"status\":\"NEW\","
				+ "\"completedDate\":null,\"modified\":1448312330383,"
				+ "\"description\":\"\",\"complete\":false}]";

		List<Task> actual = GruntWork.jsonStringToListTask(input);
		assertEquals(2, actual.size());
		assertEquals("TEST 2", actual.get(0).getName());
		assertSame(Priority.High, actual.get(0).getPriority());
		assertEquals(1448312330383L, actual.get(1).getModified());
	}
}


@@ -347,11 +347,10 @@
 d%5C%22:
-102
+94
 ,%5C%22p
@@ -455,78 +455,311 @@
 %5C%22:1
+8
 %7D,
-%22%0A%09%09%09%09+ %22%5C%22project%5C%22:null,%5C%22context%5C%22:%7B%5C%22id%5C%22:100,%5C%22name%5C%22:%5C%22Life
+%5C%22project%5C%22:null,%5C%22context%5C%22:null,%22%0A%09%09%09%09+ %22%5C%22dueDate%5C%22:null,%5C%22status%5C%22:%5C%22NEW%5C%22,%5C%22completedDate%5C%22:null,%5C%22modified%5C%22:12345678,%22%0A%09%09%09%09+ %22%5C%22description%5C%22:null,%5C%22complete%5C%22:false%7D,%22%0A%09%09%09%09// Start of second Task%0A%09%09%09%09+ %22%7B%5C%22id%5C%22:51,%5C%22priority%5C%22:%5C%22Medium%5C%22,%5C%22name%5C%22:%5C%22Phillishave 5821 cutters and plastic cap?
 %5C%22
-%7D
 ,%22%0A%09
@@ -762,38 +762,173 @@
 ,%22%0A%09%09%09%09+ %22%5C%22
-dueDate%5C%22:null
+creationDate%5C%22:%7B%5C%22year%5C%22:2015,%5C%22month%5C%22:10,%5C%22day%5C%22:18%7D,%5C%22project%5C%22:null,%5C%22context%5C%22:null,%22%0A%09%09%09%09+ %22%5C%22dueDate%5C%22:%7B%5C%22year%5C%22:2012,%5C%22month%5C%22:12,%5C%22day%5C%22:12%7D
 ,%5C%22status%5C%22:
@@ -933,14 +933,11 @@
 %22:%5C%22
-ACTIVE
+NEW
 %5C%22,%5C
@@ -958,25 +958,16 @@
 %5C%22:null,
-%22%0A%09%09%09%09+ %22
 %5C%22modifi
@@ -976,21 +976,20 @@
 %5C%22:1
-448292432791,
+23,%22%0A%09%09%09%09+ %22
 %5C%22de
@@ -1004,26 +1004,13 @@
 n%5C%22:
-%5C%22None%5C%22,%22%0A%09%09%09%09+ %22
+null,
 %5C%22co
@@ -1035,37 +1035,36 @@
 %09%09%09%09// Start of 
-secon
+thir
 d Task%0A%09%09%09%09+ %22%7B%5C
@@ -1489,17 +1489,17 @@
 tEquals(
-2
+3
 , actual
@@ -1633,27 +1633,17 @@
 Equals(1
-44831233038
+2
 3L, actu

Replace some test data, and bump the assert calls to match