예제 #1
0
  @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());
  }
예제 #2
0
  @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();
  }