@Test @DirtiesContext public void moveFromIterationToIteration_inProject() { firstIteration.setParent(firstProject); secondIteration.setParent(firstProject); story.setBacklog(firstIteration); expect(storyTreeIntegrityBusiness.canStoryBeMovedToBacklog(story, secondIteration)) .andReturn(true); storyDAO.store(story); storyRankBusiness.removeRank(story, firstIteration); storyRankBusiness.rankToBottom(story, secondIteration); backlogHistoryEntryBusiness.updateHistory(firstIteration.getId()); backlogHistoryEntryBusiness.updateHistory(secondIteration.getId()); iterationHistoryBusiness.updateIterationHistory(firstIteration.getId()); iterationHistoryBusiness.updateIterationHistory(secondIteration.getId()); replayAll(); storyBusiness.moveStoryToBacklog(story, secondIteration); verifyAll(); assertEquals(secondIteration, story.getBacklog()); }
@Test(expected = OperationNotPermittedException.class) @DirtiesContext public void testMoveStoryAndChildren_toIteration() { Story parent = new Story(); Story child1 = new Story(); Story child2 = new Story(); parent.getChildren().add(story); story.setParent(parent); story.getChildren().add(child1); child1.setParent(story); child1.getChildren().add(child2); child2.setParent(child1); parent.setBacklog(firstProject); story.setBacklog(firstProject); child1.setBacklog(firstProject); child2.setBacklog(firstIteration); firstIteration.setParent(firstProduct); expect(backlogBusiness.getParentProduct(firstProject)).andReturn(firstProduct); expect(backlogBusiness.getParentProduct(secondIteration)).andReturn(firstProduct); replayAll(); storyBusiness.moveStoryAndChildren(story, secondIteration); verifyAll(); }
@Test(expected = IllegalArgumentException.class) public void testRankStoryUnder_invalidbacklogs() { Project proj1 = new Project(); Iteration iter = new Iteration(); iter.setParent(proj1); Project proj2 = new Project(); Iteration iter2 = new Iteration(); iter2.setParent(proj2); Story story1 = new Story(); story1.setBacklog(proj1); Story story2 = new Story(); story2.setBacklog(proj2); replayAll(); storyBusiness.rankStoryUnder(story1, story2, proj1); verifyAll(); }
@Test @DirtiesContext public void testMoveStoryAndChildren() { Story parent = new Story(); Story child1 = new Story(); Story child2 = new Story(); parent.getChildren().add(story); story.setParent(parent); story.getChildren().add(child1); child1.setParent(story); child1.getChildren().add(child2); child2.setParent(child1); parent.setBacklog(firstProject); story.setBacklog(firstProject); child1.setBacklog(firstProject); child2.setBacklog(firstIteration); firstIteration.setParent(firstProduct); expect(storyTreeIntegrityBusiness.hasParentStoryConflict(story, secondProject)).andReturn(true); storyHierarchyBusiness.updateChildrenTreeRanks(parent); expect(backlogBusiness.getParentProduct(firstProject)).andReturn(firstProduct).anyTimes(); expect(backlogBusiness.getParentProduct(secondProject)).andReturn(firstProduct).anyTimes(); storyDAO.store(child2); storyRankBusiness.removeRank(child2, firstIteration); storyRankBusiness.removeRank(child2, firstIteration.getParent()); storyRankBusiness.rankToBottom(child2, secondProject); storyDAO.store(child1); storyDAO.store(story); backlogHistoryEntryBusiness.updateHistory(firstIteration.getId()); backlogHistoryEntryBusiness.updateHistory(secondProject.getId()); iterationHistoryBusiness.updateIterationHistory(firstIteration.getId()); backlogHistoryEntryBusiness.updateHistory(firstProject.getId()); EasyMock.expectLastCall().times(2); backlogHistoryEntryBusiness.updateHistory(secondProject.getId()); EasyMock.expectLastCall().times(2); replayAll(); storyBusiness.moveStoryAndChildren(story, secondProject); verifyAll(); }
private void constructBacklogs() { product = new Product(); project1 = new Project(); project2 = new Project(); iteration = new Iteration(); product.setChildren(new HashSet<Backlog>(Arrays.asList(project1, project2))); project1.setParent(product); project1.setChildren(new HashSet<Backlog>(Arrays.asList(iteration))); iteration.setParent(project1); project2.setParent(product); }
@Before public void setUpStorysProjectResponsiblesData() { Iteration iter = new Iteration(); Project proj = new Project(); Product prod = new Product(); iter.setParent(proj); proj.setParent(prod); assignedUser = new User(); assignedUser.setId(2233); storyInIteration = new Story(); storyInProject = new Story(); storyInProduct = new Story(); storyInIteration.setId(868); storyInProduct.setId(951); storyInProject.setId(3); storyInIteration.setIteration(iter); storyInIteration.setBacklog(proj); storyInProject.setBacklog(proj); storyInProduct.setBacklog(prod); }
@Test @DirtiesContext public void testHasParentStoryConflict_toIteration() { Product product = new Product(); Project project = new Project(); Iteration iteration = new Iteration(); Story parentStory = new Story(); Story story = new Story(); iteration.setParent(project); project.setParent(product); parentStory.setBacklog(project); story.setBacklog(project); story.setParent(parentStory); expect(this.backlogBusiness.getParentProduct(iteration)).andReturn(product); expect(this.backlogBusiness.getParentProduct(project)).andReturn(product); replayAll(); assertFalse(this.testable.hasParentStoryConflict(story, iteration)); verifyAll(); }