@Test void saveDiscountValuesWithPlace() { Place place = ModelUtils.getPlace(); Specification specification = ModelUtils.getSpecification(); DiscountValue discountValue = ModelUtils.getDiscountValue(); discountValue.setSpecification(ModelUtils.getSpecification()); DiscountValue discountValueTest = ModelUtils.getDiscountValue(); discountValueTest.setSpecification(specification); discountValueTest.setPlace(place); when(specService.findByName(discountValue.getSpecification().getName())).thenReturn(specification); proposePlaceService.saveDiscountValuesWithPlace(Collections.singleton(discountValue), place); assertEquals(Collections.singleton(discountValueTest), Collections.singleton(discountValue)); }
@Override public void saveDiscountValuesWithPlace(Set<DiscountValue> discountValues, Place place) { discountValues.forEach(disc -> { disc.setSpecification(specService.findByName(disc.getSpecification().getName())); disc.setPlace(place); }); }
ProposePlaceServiceImpl implements ProposePlaceService { @Override public void saveDiscountValuesWithPlace(Set<DiscountValue> discountValues, Place place) { discountValues.forEach(disc -> { disc.setSpecification(specService.findByName(disc.getSpecification().getName())); disc.setPlace(place); }); } }
ProposePlaceServiceImpl implements ProposePlaceService { @Override public void saveDiscountValuesWithPlace(Set<DiscountValue> discountValues, Place place) { discountValues.forEach(disc -> { disc.setSpecification(specService.findByName(disc.getSpecification().getName())); disc.setPlace(place); }); }  }
ProposePlaceServiceImpl implements ProposePlaceService { @Override public void saveDiscountValuesWithPlace(Set<DiscountValue> discountValues, Place place) { discountValues.forEach(disc -> { disc.setSpecification(specService.findByName(disc.getSpecification().getName())); disc.setPlace(place); }); }  @Override void checkLocationValues(LocationAddressAndGeoDto dto); @Override void checkInputTime(Set<OpeningHoursDto> dto); @Override void savePhotosWithPlace(List<Photo> photos, Place place); @Override void saveDiscountValuesWithPlace(Set<DiscountValue> discountValues, Place place); }
ProposePlaceServiceImpl implements ProposePlaceService { @Override public void saveDiscountValuesWithPlace(Set<DiscountValue> discountValues, Place place) { discountValues.forEach(disc -> { disc.setSpecification(specService.findByName(disc.getSpecification().getName())); disc.setPlace(place); }); }  @Override void checkLocationValues(LocationAddressAndGeoDto dto); @Override void checkInputTime(Set<OpeningHoursDto> dto); @Override void savePhotosWithPlace(List<Photo> photos, Place place); @Override void saveDiscountValuesWithPlace(Set<DiscountValue> discountValues, Place place);  }