@Test public void shouldSaveChildCoverage() throws Exception { ChildCoverageLineItem childCoverageLineItem = new ChildCoverageLineItem(); OpenedVialLineItem openedVialLineItem = new OpenedVialLineItem(); VaccinationChildCoverage vaccinationChildCoverage = new VaccinationChildCoverage(); vaccinationChildCoverage.setChildCoverageLineItems(asList(childCoverageLineItem)); vaccinationChildCoverage.setOpenedVialLineItems(asList(openedVialLineItem)); repository.saveChildCoverage(vaccinationChildCoverage); verify(mapper).insertChildCoverageLineItem(childCoverageLineItem); verify(mapper).insertChildCoverageOpenedVialLineItem(openedVialLineItem); }
public void saveChildCoverage(VaccinationChildCoverage childCoverage) { for (ChildCoverageLineItem childCoverageLineItem : childCoverage.getChildCoverageLineItems()) { if (childCoverageLineItem.getId() == null) { mapper.insertChildCoverageLineItem(childCoverageLineItem); } else { mapper.updateChildCoverageLineItem(childCoverageLineItem); } } for (OpenedVialLineItem openedVialLineItem : childCoverage.getOpenedVialLineItems()) { if (openedVialLineItem.getId() == null) { mapper.insertChildCoverageOpenedVialLineItem(openedVialLineItem); } else { mapper.updateChildCoverageOpenedVialLineItem(openedVialLineItem); } } }
VaccinationCoverageRepository { public void saveChildCoverage(VaccinationChildCoverage childCoverage) { for (ChildCoverageLineItem childCoverageLineItem : childCoverage.getChildCoverageLineItems()) { if (childCoverageLineItem.getId() == null) { mapper.insertChildCoverageLineItem(childCoverageLineItem); } else { mapper.updateChildCoverageLineItem(childCoverageLineItem); } } for (OpenedVialLineItem openedVialLineItem : childCoverage.getOpenedVialLineItems()) { if (openedVialLineItem.getId() == null) { mapper.insertChildCoverageOpenedVialLineItem(openedVialLineItem); } else { mapper.updateChildCoverageOpenedVialLineItem(openedVialLineItem); } } } }
VaccinationCoverageRepository { public void saveChildCoverage(VaccinationChildCoverage childCoverage) { for (ChildCoverageLineItem childCoverageLineItem : childCoverage.getChildCoverageLineItems()) { if (childCoverageLineItem.getId() == null) { mapper.insertChildCoverageLineItem(childCoverageLineItem); } else { mapper.updateChildCoverageLineItem(childCoverageLineItem); } } for (OpenedVialLineItem openedVialLineItem : childCoverage.getOpenedVialLineItems()) { if (openedVialLineItem.getId() == null) { mapper.insertChildCoverageOpenedVialLineItem(openedVialLineItem); } else { mapper.updateChildCoverageOpenedVialLineItem(openedVialLineItem); } } }  }
VaccinationCoverageRepository { public void saveChildCoverage(VaccinationChildCoverage childCoverage) { for (ChildCoverageLineItem childCoverageLineItem : childCoverage.getChildCoverageLineItems()) { if (childCoverageLineItem.getId() == null) { mapper.insertChildCoverageLineItem(childCoverageLineItem); } else { mapper.updateChildCoverageLineItem(childCoverageLineItem); } } for (OpenedVialLineItem openedVialLineItem : childCoverage.getOpenedVialLineItems()) { if (openedVialLineItem.getId() == null) { mapper.insertChildCoverageOpenedVialLineItem(openedVialLineItem); } else { mapper.updateChildCoverageOpenedVialLineItem(openedVialLineItem); } } }  void saveFullCoverage(VaccinationFullCoverage vaccinationFullCoverage); VaccinationFullCoverage getFullCoverageBy(Long facilityVisitId); List<TargetGroupProduct> getVaccinationProducts(); void saveChildCoverage(VaccinationChildCoverage childCoverage); VaccinationChildCoverage getChildCoverageBy(Long facilityVisitId); List<ProductVial> getProductVials(); void saveAdultCoverage(VaccinationAdultCoverage adultCoverage); VaccinationAdultCoverage getAdultCoverageBy(Long facilityVisitId); }
VaccinationCoverageRepository { public void saveChildCoverage(VaccinationChildCoverage childCoverage) { for (ChildCoverageLineItem childCoverageLineItem : childCoverage.getChildCoverageLineItems()) { if (childCoverageLineItem.getId() == null) { mapper.insertChildCoverageLineItem(childCoverageLineItem); } else { mapper.updateChildCoverageLineItem(childCoverageLineItem); } } for (OpenedVialLineItem openedVialLineItem : childCoverage.getOpenedVialLineItems()) { if (openedVialLineItem.getId() == null) { mapper.insertChildCoverageOpenedVialLineItem(openedVialLineItem); } else { mapper.updateChildCoverageOpenedVialLineItem(openedVialLineItem); } } }  void saveFullCoverage(VaccinationFullCoverage vaccinationFullCoverage); VaccinationFullCoverage getFullCoverageBy(Long facilityVisitId); List<TargetGroupProduct> getVaccinationProducts(); void saveChildCoverage(VaccinationChildCoverage childCoverage); VaccinationChildCoverage getChildCoverageBy(Long facilityVisitId); List<ProductVial> getProductVials(); void saveAdultCoverage(VaccinationAdultCoverage adultCoverage); VaccinationAdultCoverage getAdultCoverageBy(Long facilityVisitId);  }