@Test @DirtiesContext public void testChangeBacklog_moveToAnotherProduct_withConflict() { Product another = new Product(); expect(backlogBusiness.getParentProduct(story_23.getBacklog())).andReturn(product); expect(backlogBusiness.getParentProduct(another)).andReturn(another); replayAll(); messages = testable.checkChangeBacklog(story_23, another); verifyAll(); assertNumberOfMessages(messages, 1); }
@Test @DirtiesContext public void testChangeBacklog_moveToDifferentBranch() { expect(backlogBusiness.getParentProduct(story_33.getBacklog())).andReturn(product); expect(backlogBusiness.getParentProduct(project1)).andReturn(product); replayAll(); messages = testable.checkChangeBacklog(story_33, project1); verifyAll(); assertNumberOfMessages(messages, 1); assertMessagesContain( messages, StoryHierarchyIntegrityViolationType.PARENT_IN_WRONG_BRANCH, story_33, story_22); }
@Test public void testStore_updateBacklogAndClearResponsibles() { this.store_createMockStoryBusiness(); Backlog newBacklog = new Project(); newBacklog.setId(123); Set<User> users = new HashSet<User>(Arrays.asList(new User(), new User())); storyInIteration.setResponsibles(users); expect(storyDAO.get(storyInIteration.getId())).andReturn(storyInIteration); expect(backlogBusiness.retrieve(newBacklog.getId())).andReturn(newBacklog); storyDAO.store(EasyMock.isA(Story.class)); blheBusiness.updateHistory(storyInIteration.getBacklog().getId()); replayAll(); Story actual = storyBusiness.store( storyInIteration.getId(), new Story(), newBacklog.getId(), new HashSet<Integer>(), false); verifyAll(); assertEquals(0, actual.getResponsibles().size()); assertTrue(storyBacklogUpdated); }
@Test @DirtiesContext public void testChangeBacklog_moveToProduct_parentInProject() { expect(backlogBusiness.getParentProduct(story_41.getBacklog())).andReturn(product); expect(backlogBusiness.getParentProduct(product)).andReturn(product); replayAll(); messages = testable.checkChangeBacklog(story_41, product); verifyAll(); assertNumberOfMessages(messages, 1); assertMessagesContain( messages, StoryHierarchyIntegrityViolationType.PARENT_DEEPER_IN_HIERARCHY, story_41, story_31); }
@Test @DirtiesContext public void testChangeBacklog_hasChildren_movingToIteration() { expect(backlogBusiness.getParentProduct(story_31.getBacklog())).andReturn(product); expect(backlogBusiness.getParentProduct(iteration)).andReturn(product); replayAll(); messages = testable.checkChangeBacklog(story_31, iteration); verifyAll(); assertNumberOfMessages(messages, 1); assertMessagesContain( messages, StoryHierarchyIntegrityViolationType.MOVE_TO_ITERATION_HAS_CHILDREN, story_31, null); }
@Test @DirtiesContext public void testChangeBacklog_hasChildren_notUnderTargetBacklog() { expect(backlogBusiness.getParentProduct(story_21.getBacklog())).andReturn(product); expect(backlogBusiness.getParentProduct(project2)).andReturn(product); replayAll(); messages = testable.checkChangeBacklog(story_21, project2); verifyAll(); assertNumberOfMessages(messages, 3); assertMessagesContain( messages, StoryHierarchyIntegrityViolationType.CHILD_IN_WRONG_BRANCH, story_21, story_31); assertMessagesContain( messages, StoryHierarchyIntegrityViolationType.CHILD_IN_WRONG_BRANCH, story_31, story_41); assertMessagesContain( messages, StoryHierarchyIntegrityViolationType.CHILD_IN_WRONG_BRANCH, story_21, story_32); }