@Test
 public void testRankStoryToBottom() {
   Story story = new Story();
   storyRankBusiness.rankToBottom(story, backlog);
   replayAll();
   Story actual = storyBusiness.rankStoryToBottom(story, backlog);
   verifyAll();
   assertSame(actual, story);
 }
 @Test
 public void testUpdateRanks_noChildren_NoRank() {
   Story story = new Story();
   Project backlog = new Project();
   story.setBacklog(backlog);
   storyRankBusiness.rankToBottom(story, backlog);
   replayAll();
   storyBusiness.updateStoryRanks(story);
   verifyAll();
 }
 @Test
 public void checksThatStorysIterationMatches_rankOver() {
   Iteration ite = new Iteration();
   Story story = new Story();
   story.setIteration(ite);
   Story ref = new Story();
   ref.setIteration(ite);
   storyRankBusiness.rankAbove(story, ite, ref);
   replayAll();
   storyBusiness.rankStoryOver(story, ref, null);
   verifyAll();
 }
 @Test
 public void testRankStoryOver() {
   Backlog blog = new Project();
   Story story = new Story();
   story.setBacklog(blog);
   Story ref = new Story();
   ref.setBacklog(blog);
   storyRankBusiness.rankAbove(story, blog, ref);
   replayAll();
   storyBusiness.rankStoryOver(story, ref, blog);
   verifyAll();
 }
  @Test
  public void testUpdateRanks_children_HasRank() {
    Story story = new Story();
    Project backlog = new Project();
    story.setBacklog(backlog);
    StoryRank rank = new StoryRank();
    story.getStoryRanks().add(rank);
    Story child = new Story();
    story.getChildren().add(child);

    storyRankBusiness.removeStoryRanks(story);
    replayAll();
    storyBusiness.updateStoryRanks(story);
    verifyAll();
  }
  @Test
  public void testDelete_onlyChildRemoved() {
    Story parent = new Story();
    Story child = new Story();
    Backlog backlog = new Project();
    backlog.setId(1);

    parent.getChildren().add(child);
    child.setParent(parent);
    child.setBacklog(backlog);
    parent.setBacklog(backlog);

    storyRankBusiness.rankToBottom(parent, backlog);
    //        storyRankBusiness.removeStoryRanks(child);
    storyHierarchyBusiness.updateChildrenTreeRanks(parent);
    storyDAO.remove(child);
    replayAll();
    storyBusiness.delete(child, null, null, null, null);
    verifyAll();
    assertTrue(parent.getChildren().isEmpty());
  }