public void test_store_localtask() { Task task = TestUtils.makeSimpleTask(); task.setLocal(); DeviceStorage ds = new DeviceStorage(getContext()); ds.storeTask(task); }
public void test_retrieve_localtask() { Task task = TestUtils.makeSimpleTask(); task.setLocal(); DeviceStorage ds = new DeviceStorage(getContext()); ds.storeTask(task); Collection<Task> taskList = ds.getLocalTasks(); assertNotNull(taskList); }
public void test_retrieve_globaltask() { // put in 1 global task Task task = TestUtils.makeSimpleTask(); task.setLocal(); DeviceStorage ds = new DeviceStorage(getContext()); ds.storeTask(task); Collection<Task> taskList = ds.getGlobalTasks(); assertEquals(1, taskList.size()); }
public void test_retrieve_requests() { Task task = TestUtils.makeSimpleTask(); task.setLocal(); // ADDED BY MITCHELL Request r = TestUtils.makeSimpleRequest(); r.setDescription("I've got a new description"); task.addRequest(r); DeviceStorage ds = new DeviceStorage(getContext()); ds.storeTask(task); Collection<Task> taskList = ds.getLocalTasks(); Iterator<Task> iter = taskList.iterator(); while (iter.hasNext()) { Task t = iter.next(); if (t.getId().toString().equals(task.getId().toString())) { for (Request req : t) { // System.out.println(req.getDescription()); assertEquals(req.getDescription(), r.getDescription()); } } } }
public void test_retrieve_samelocaltask() { Task task = TestUtils.makeSimpleTask(); task.setLocal(); DeviceStorage ds = new DeviceStorage(getContext()); ds.storeTask(task); Collection<Task> taskList = ds.getLocalTasks(); Iterator<Task> iter = taskList.iterator(); while (iter.hasNext()) { Task t = iter.next(); if (t.getId().toString().equals(task.getId().toString())) { assertEquals(task.getId().toString(), t.getId().toString()); } } }