### Question:
TransactionalForumStructureService implements ForumStructureService { @Override public void moveBranch(PoulpeBranch branch, PoulpeSection toSection) { PoulpeSection fromSection = branch.moveTo(toSection); sectionDao.saveOrUpdate(fromSection); sectionDao.saveOrUpdate(toSection); } TransactionalForumStructureService(SectionDao sectionDao, BranchDao branchDao, ComponentDao componentDao,
            JCommuneNotifier jCommuneNotifier); @Override void saveJcommune(Jcommune jcommune); @Override Jcommune getJcommune(); @Override void removeBranch(PoulpeBranch branch); @Override void moveBranch(PoulpeBranch branch, PoulpeSection toSection); @Override Jcommune deleteSectionWithBranches(PoulpeSection section); @Override void deleteSectionAndMoveBranches(PoulpeSection toRemove, PoulpeSection toReceiveBranches); @Override PoulpeBranch saveBranch(PoulpeSection inSection, PoulpeBranch notYetSavedBranch); @Override void moveBranch(PoulpeBranch branch, PoulpeBranch target); @Override void moveSection(PoulpeSection section, PoulpeSection target);  }### Answer:
@Test(dataProvider = "provideJcommuneWithSectionsAndBranches") public void testMoveBranchInSameSection(Jcommune jcommune) { PoulpeSection section = jcommune.getSections().get(0); PoulpeBranch branch = section.getBranch(1); PoulpeBranch target = section.getBranch(3); List<PoulpeBranch> expectedBranches = new ArrayList<PoulpeBranch>(section.getPoulpeBranches()); expectedBranches.remove(branch); expectedBranches.add(section.getPoulpeBranches().indexOf(target), branch); sut.moveBranch(branch, target); assertEquals(section.getPoulpeBranches(), expectedBranches); branch = section.getBranch(4); target = section.getBranch(0); expectedBranches.remove(branch); expectedBranches.add(section.getPoulpeBranches().indexOf(target), branch); sut.moveBranch(branch, target); assertEquals(section.getPoulpeBranches(), expectedBranches); }
@Test(dataProvider = "provideJcommuneWithSectionsAndBranches") public void testMoveBranchToAnotherSection(Jcommune jcommune) { PoulpeSection section1 = jcommune.getSections().get(0); PoulpeSection section2 = jcommune.getSections().get(1); PoulpeBranch branch = section1.getBranch(0); PoulpeBranch target = section2.getBranch(0); List<PoulpeBranch> expectedBranchesInSection1 = new ArrayList<PoulpeBranch>(section1.getPoulpeBranches()); List<PoulpeBranch> expectedBranchesInSection2 = new ArrayList<PoulpeBranch>(section2.getPoulpeBranches()); expectedBranchesInSection1.remove(branch); expectedBranchesInSection2.add(0, branch); sut.moveBranch(branch, target); assertEquals(section1.getBranches(), expectedBranchesInSection1); assertEquals(section2.getBranches(), expectedBranchesInSection2); target = section1.getBranch(0); expectedBranchesInSection2.remove(branch); expectedBranchesInSection1.add(0, branch); sut.moveBranch(branch, target); assertEquals(section1.getBranches(), expectedBranchesInSection1); assertEquals(section2.getBranches(), expectedBranchesInSection2); }