@Test public void overwrite_Departments() { CommonCourtDivisionType civilType = new CommonCourtDivisionType(); civilType.setCode("03"); civilType.setName("civil"); CommonCourtDivisionType criminalType = new CommonCourtDivisionType(); civilType.setCode("06"); civilType.setName("criminal"); CommonCourtDivision division1 = createDivision("05", "Cywilny", civilType); CommonCourtDivision division2 = createDivision("10", "Karny", criminalType); newCourt.addDivision(division1); newCourt.addDivision(division2); CommonCourtDivision division3 = createDivision("05", "Karny Nieletnich", criminalType); CommonCourtDivision division4 = createDivision("15", "Karny Nieletnich", criminalType); oldCourt.addDivision(division3); oldCourt.addDivision(division4); commonCourtOverwriter.overwrite(oldCourt, newCourt); assertEquals(2, newCourt.getDivisions().size()); assertDivision(division1, newCourt, newCourt.getDivisions().get(0)); assertDivision(division2, newCourt, newCourt.getDivisions().get(1)); assertEquals(3, oldCourt.getDivisions().size()); assertDivision(division1, oldCourt, oldCourt.getDivisions().get(0)); assertDivision(division2, oldCourt, oldCourt.getDivisions().get(2)); assertDivision(division4, oldCourt, oldCourt.getDivisions().get(1)); assertFalse(division4.isActive()); }
public void overwrite(CommonCourt oldCommonCourt, CommonCourt newCommonCourt) { oldCommonCourt.setName(newCommonCourt.getName()); oldCommonCourt.setType(newCommonCourt.getType()); overwriteDepartments(oldCommonCourt, newCommonCourt); }
CommonCourtOverwriter { public void overwrite(CommonCourt oldCommonCourt, CommonCourt newCommonCourt) { oldCommonCourt.setName(newCommonCourt.getName()); oldCommonCourt.setType(newCommonCourt.getType()); overwriteDepartments(oldCommonCourt, newCommonCourt); } }
CommonCourtOverwriter { public void overwrite(CommonCourt oldCommonCourt, CommonCourt newCommonCourt) { oldCommonCourt.setName(newCommonCourt.getName()); oldCommonCourt.setType(newCommonCourt.getType()); overwriteDepartments(oldCommonCourt, newCommonCourt); }  }
CommonCourtOverwriter { public void overwrite(CommonCourt oldCommonCourt, CommonCourt newCommonCourt) { oldCommonCourt.setName(newCommonCourt.getName()); oldCommonCourt.setType(newCommonCourt.getType()); overwriteDepartments(oldCommonCourt, newCommonCourt); }  void overwrite(CommonCourt oldCommonCourt, CommonCourt newCommonCourt); }
CommonCourtOverwriter { public void overwrite(CommonCourt oldCommonCourt, CommonCourt newCommonCourt) { oldCommonCourt.setName(newCommonCourt.getName()); oldCommonCourt.setType(newCommonCourt.getType()); overwriteDepartments(oldCommonCourt, newCommonCourt); }  void overwrite(CommonCourt oldCommonCourt, CommonCourt newCommonCourt);  }