@Test
  @DirtiesContext
  public void moveSingleFromProjectToProjectNoViolation() {
    Story parent = new Story();
    Story child = new Story();
    story.setBacklog(secondProject);
    story.setParent(parent);
    story.getChildren().add(child);
    child.setParent(story);

    expect(backlogBusiness.getParentProduct(secondProject)).andReturn(firstProduct).anyTimes();
    expect(backlogBusiness.getParentProduct(firstProject)).andReturn(firstProduct).anyTimes();

    storyDAO.store(child);
    storyDAO.store(story);
    expect(storyTreeIntegrityBusiness.hasParentStoryConflict(story, firstProject)).andReturn(false);
    storyHierarchyBusiness.updateChildrenTreeRanks(parent);
    backlogHistoryEntryBusiness.updateHistory(secondProject.getId());
    backlogHistoryEntryBusiness.updateHistory(firstProject.getId());

    storyRankBusiness.removeRank(story, secondProject);
    storyRankBusiness.rankToBottom(story, firstProject);
    replayAll();

    storyBusiness.moveSingleStoryToBacklog(story, firstProject);
    verifyAll();
    assertEquals(firstProject, story.getBacklog());
    assertEquals(parent, story.getParent());
    assertEquals(parent, child.getParent());
  }
  /** 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_deleteChoices_withChildren() {
    Story child = new Story();
    Story storyParent = new Story();
    storyParent.setBacklog(new Product());
    child.setParent(storyInIteration);
    storyInIteration.setParent(storyParent);
    storyInIteration.getChildren().add(child);

    storyHierarchyBusiness.updateChildrenTreeRanks(storyParent);
    hourEntryBusiness.deleteAll(storyInIteration.getHourEntries());
    //        storyRankBusiness.removeStoryRanks(storyInIteration);
    storyDAO.remove(storyInIteration);
    replayAll();
    storyBusiness.delete(
        storyInIteration,
        TaskHandlingChoice.DELETE,
        HourEntryHandlingChoice.DELETE,
        HourEntryHandlingChoice.DELETE,
        ChildHandlingChoice.MOVE);
    assertEquals(storyParent, child.getParent());
    assertTrue(storyInIteration.getChildren().isEmpty());
    verifyAll();
  }