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

    assertNotNull(reportManager.getTaskOfCase(fsCase.getId()));
  }
  /**
   * 生成事件测试数据
   *
   * @param name 名称
   * @param county 区县
   */
  private FsCase generateFsCase(String name, Dept county) {
    FsCase fsCase = new FsCase();
    fsCase.setTitle(name);
    fsCase.setAddress("石家庄裕华区");
    fsCase.setCaseTime(new Date());
    fsCase.setCounty(county);

    return fsCase;
  }
  /** 测试删除上报事件及相关任务 */
  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()));
  }