@Test public void shouldSaveFacilityDistributionFormsIfFacilityVisited() throws Exception { EpiUse epiUse = new EpiUse(); FacilityVisit facilityVisit = new FacilityVisit(); facilityVisit.setFacilityId(1234L); facilityVisit.setVisited(true); DistributionRefrigerators distributionRefrigerators = new DistributionRefrigerators(); EpiInventory epiInventory = new EpiInventory(); VaccinationFullCoverage vaccinationFullCoverage = new VaccinationFullCoverage(); FacilityDistribution facilityDistribution = new FacilityDistribution(facilityVisit, epiUse, distributionRefrigerators, epiInventory, vaccinationFullCoverage, null, null); facilityDistributionService.save(facilityDistribution); verify(facilityVisitService).save(facilityVisit); verify(epiUseService).save(epiUse); verify(vaccinationCoverageService).save(facilityDistribution); verify(epiInventoryService).save(epiInventory); verify(distributionRefrigeratorsService).save(1234L, distributionRefrigerators); }
public FacilityDistribution save(FacilityDistribution facilityDistribution) { facilityVisitService.save(facilityDistribution.getFacilityVisit()); if (facilityDistribution.getFacilityVisit().getVisited()) { epiInventoryService.save(facilityDistribution.getEpiInventory()); distributionRefrigeratorsService.save(facilityDistribution.getFacilityVisit().getFacilityId(), facilityDistribution.getRefrigerators()); epiUseService.save(facilityDistribution.getEpiUse()); } vaccinationCoverageService.save(facilityDistribution); return facilityDistribution; }
FacilityDistributionService { public FacilityDistribution save(FacilityDistribution facilityDistribution) { facilityVisitService.save(facilityDistribution.getFacilityVisit()); if (facilityDistribution.getFacilityVisit().getVisited()) { epiInventoryService.save(facilityDistribution.getEpiInventory()); distributionRefrigeratorsService.save(facilityDistribution.getFacilityVisit().getFacilityId(), facilityDistribution.getRefrigerators()); epiUseService.save(facilityDistribution.getEpiUse()); } vaccinationCoverageService.save(facilityDistribution); return facilityDistribution; } }
FacilityDistributionService { public FacilityDistribution save(FacilityDistribution facilityDistribution) { facilityVisitService.save(facilityDistribution.getFacilityVisit()); if (facilityDistribution.getFacilityVisit().getVisited()) { epiInventoryService.save(facilityDistribution.getEpiInventory()); distributionRefrigeratorsService.save(facilityDistribution.getFacilityVisit().getFacilityId(), facilityDistribution.getRefrigerators()); epiUseService.save(facilityDistribution.getEpiUse()); } vaccinationCoverageService.save(facilityDistribution); return facilityDistribution; }  }
FacilityDistributionService { public FacilityDistribution save(FacilityDistribution facilityDistribution) { facilityVisitService.save(facilityDistribution.getFacilityVisit()); if (facilityDistribution.getFacilityVisit().getVisited()) { epiInventoryService.save(facilityDistribution.getEpiInventory()); distributionRefrigeratorsService.save(facilityDistribution.getFacilityVisit().getFacilityId(), facilityDistribution.getRefrigerators()); epiUseService.save(facilityDistribution.getEpiUse()); } vaccinationCoverageService.save(facilityDistribution); return facilityDistribution; }  Map<Long, FacilityDistribution> createFor(Distribution distribution); FacilityDistribution save(FacilityDistribution facilityDistribution); FacilityDistribution setSynced(FacilityDistribution facilityDistribution); Map<Long, FacilityDistribution> get(Distribution distribution); }
FacilityDistributionService { public FacilityDistribution save(FacilityDistribution facilityDistribution) { facilityVisitService.save(facilityDistribution.getFacilityVisit()); if (facilityDistribution.getFacilityVisit().getVisited()) { epiInventoryService.save(facilityDistribution.getEpiInventory()); distributionRefrigeratorsService.save(facilityDistribution.getFacilityVisit().getFacilityId(), facilityDistribution.getRefrigerators()); epiUseService.save(facilityDistribution.getEpiUse()); } vaccinationCoverageService.save(facilityDistribution); return facilityDistribution; }  Map<Long, FacilityDistribution> createFor(Distribution distribution); FacilityDistribution save(FacilityDistribution facilityDistribution); FacilityDistribution setSynced(FacilityDistribution facilityDistribution); Map<Long, FacilityDistribution> get(Distribution distribution);  }