/**
   * 生成任务测试数据
   *
   * @param name 名称
   */
  private Task generateTask(String name) {
    Task task = new Task();
    task.setTitle(name);
    task.setDescn("任务 " + name + " 描述");

    return task;
  }
  /** 测试根据上报事件取得对应事件的任务信息 */
  public void testGetTaskOfCase() {
    FsCase fsCase = generateFsCase("测试事件取得", county);
    Task task = generateTask("测试任务取得");
    task.setFsCase(fsCase);
    fsCaseManager.save(fsCase);
    taskManager.save(task);

    assertNotNull(reportManager.getTaskOfCase(fsCase.getId()));
  }
  /** 测试根据任务ID取得该任务的详细信息 */
  public void testGetTaskDetailOfTask() {
    Task task = generateTask("测试任务及详细");
    TaskDetail taskDetail = generateTaskDetail("测试任务明细");
    taskDetail.setTask(task);
    taskDetail.setDept(county);
    taskManager.save(task);
    taskManager.getDao().save(taskDetail);
    TaskDetail taskDetailRst = reportManager.getTaskDetailOfTask(task.getId(), county.getId());

    assertNotNull(taskDetailRst);
  }
  /** 测试删除上报事件及相关任务 */
  public void testRemoveCase() {
    FsCase fsCase = generateFsCase("测试事件", county);
    Task task = generateTask("测试任务");
    TaskDetail taskDetail = generateTaskDetail("测试任务处理结果");
    task.setFsCase(fsCase);
    taskDetail.setTask(task);
    fsCaseManager.save(fsCase);
    taskManager.save(task);
    taskManager.getDao().save(taskDetail);
    reportManager.removeCase(fsCase.getId());

    assertNull(fsCaseManager.get(fsCase.getId()));
  }
  /** 测试保存部门上报事件 */
  public void testSaveReportInfoOfCase() {
    Corp corp = generateCorp("测试企业", "石家庄大学", county);
    corpManager.save(corp);

    FsCase fsCase1 = generateFsCase("事件1", county);
    Task task1 = generateTask("任务1");
    TaskDetail taskDetail1 = generateTaskDetail("成功的办他1");

    FsCase fsCase2 = generateFsCase("事件2", county);
    Task task2 = generateTask("任务2");
    TaskDetail taskDetail2 = generateTaskDetail("成功的办他2");

    reportManager.saveReportInfoOfCase(fsCase1, task1, taskDetail1, corp, "企业1");
    assertEquals("事件1", reportManager.get(fsCase1.getId()).getTitle());
    assertEquals("任务1", taskManager.get(task1.getId()).getTitle());
    Corp rstCorp = corpManager.findObject("from Corp c where c.name = ?", "企业1");
    assertNotNull(rstCorp);

    reportManager.saveReportInfoOfCase(fsCase2, task2, taskDetail2, corp, "测试企业");
    assertNotNull(reportManager.get(fsCase2.getId()));
    assertNotNull(taskManager.get(task2.getId()));
  }