/** TEST FORCE DELETING */
  @Test
  public void testForceDelete() {
    Story story = new Story();
    story.setId(1);

    Story child = new Story();
    child.setParent(story);
    story.setChildren(new ArrayList<Story>(Arrays.asList(child)));

    story.setTasks(new HashSet<Task>(Arrays.asList(new Task(), new Task())));
    story.setHourEntries(
        new HashSet<StoryHourEntry>(
            Arrays.asList(new StoryHourEntry(), new StoryHourEntry(), new StoryHourEntry())));

    taskBusiness.delete(EasyMock.isA(Task.class), EasyMock.same(HourEntryHandlingChoice.DELETE));
    expectLastCall().times(2);

    hourEntryBusiness.deleteAll(story.getHourEntries());

    storyDAO.remove(1);

    replayAll();
    storyBusiness.forceDelete(story);
    verifyAll();

    assertNull("Child story's parent not null", child.getParent());
    assertEquals("Parent story's children not empty", 0, story.getChildren().size());
  }
 @Test
 public void testDelete_taskChoice_move() {
   Task task = new Task();
   storyInIteration.getTasks().add(task);
   expect(taskBusiness.move(task, storyInIteration.getBacklog().getId(), null)).andReturn(task);
   //        storyRankBusiness.removeStoryRanks(storyInIteration);
   storyDAO.remove(storyInIteration);
   replayAll();
   storyBusiness.delete(storyInIteration, TaskHandlingChoice.MOVE, null, null, null);
   verifyAll();
   assertTrue(storyInIteration.getTasks().isEmpty());
 }
 @Test
 public void testDelete_taskChoice_delete() {
   Task task = new Task();
   storyInIteration.getTasks().add(task);
   hourEntryBusiness.moveToBacklog(task.getHourEntries(), storyInIteration.getBacklog());
   taskBusiness.delete(task.getId(), HourEntryHandlingChoice.MOVE);
   //        storyRankBusiness.removeStoryRanks(storyInIteration);
   storyDAO.remove(storyInIteration);
   replayAll();
   storyBusiness.delete(
       storyInIteration, TaskHandlingChoice.DELETE, null, HourEntryHandlingChoice.MOVE, null);
   verifyAll();
   assertNull(task.getStory());
   assertTrue(storyInIteration.getTasks().isEmpty());
 }
  @Test
  public void testStore_tasksToDone() {
    Task task1 = new Task();
    task1.setId(11);
    task1.setState(TaskState.BLOCKED);

    Task task2 = new Task();
    task2.setId(12);
    task2.setState(TaskState.PENDING);

    story1.setIteration(iteration);
    story1.setTasks(new HashSet<Task>(Arrays.asList(task1, task2)));

    expect(storyDAO.get(story1.getId())).andReturn(story1);
    storyDAO.store(story1);

    taskBusiness.setTaskToDone(task1);
    taskBusiness.setTaskToDone(task2);
    iheBusiness.updateIterationHistory(story1.getIteration().getId());

    replayAll();
    storyBusiness.store(story1.getId(), story1, null, null, true);
    verifyAll();
  }