コード例 #1
0
  public void test_store_localtask() {
    Task task = TestUtils.makeSimpleTask();
    task.setLocal();
    DeviceStorage ds = new DeviceStorage(getContext());

    ds.storeTask(task);
  }
コード例 #2
0
  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);
  }
コード例 #3
0
  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());
  }
コード例 #4
0
  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());
        }
      }
    }
  }
コード例 #5
0
  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());
      }
    }
  }