@Test public void shouldTransformAdultCoverageDTOToVaccinationAdultCoverage() throws Exception { AdultCoverageLineItemDTO adultCoverageLineItemDTO = mock(AdultCoverageLineItemDTO.class); OpenedVialLineItemDTO openedVialLineItemDTO = mock(OpenedVialLineItemDTO.class); AdultCoverageDTO adultCoverageDTO = new AdultCoverageDTO(); adultCoverageDTO.setModifiedBy(12345L); adultCoverageDTO.setAdultCoverageLineItems(asList(adultCoverageLineItemDTO)); adultCoverageDTO.setOpenedVialLineItems(asList(openedVialLineItemDTO)); AdultCoverageLineItem adultCoverageLineItem = new AdultCoverageLineItem(); when(adultCoverageLineItemDTO.transform()).thenReturn(adultCoverageLineItem); OpenedVialLineItem openedVialLineItem = new OpenedVialLineItem(); when(openedVialLineItemDTO.transform()).thenReturn(openedVialLineItem); VaccinationAdultCoverage vaccinationAdultCoverage = adultCoverageDTO.transform(); assertThat(vaccinationAdultCoverage.getAdultCoverageLineItems().get(0), is(adultCoverageLineItem)); assertThat(vaccinationAdultCoverage.getOpenedVialLineItems().get(0), is(openedVialLineItem)); verify(adultCoverageLineItemDTO).setModifiedBy(12345L); verify(openedVialLineItemDTO).setModifiedBy(12345L); }
public VaccinationAdultCoverage transform() { VaccinationAdultCoverage adultCoverage = new VaccinationAdultCoverage(); List<AdultCoverageLineItem> adultCoverageLineItems = new ArrayList<>(); for (AdultCoverageLineItemDTO lineItemDTO : this.adultCoverageLineItems) { lineItemDTO.setModifiedBy(this.modifiedBy); adultCoverageLineItems.add(lineItemDTO.transform()); } List<OpenedVialLineItem> openedVialLineItems = new ArrayList<>(); for (OpenedVialLineItemDTO lineItemDTO : this.openedVialLineItems) { lineItemDTO.setModifiedBy(this.modifiedBy); openedVialLineItems.add(lineItemDTO.transform()); } adultCoverage.setAdultCoverageLineItems(adultCoverageLineItems); adultCoverage.setOpenedVialLineItems(openedVialLineItems); return adultCoverage; }
AdultCoverageDTO extends BaseModel { public VaccinationAdultCoverage transform() { VaccinationAdultCoverage adultCoverage = new VaccinationAdultCoverage(); List<AdultCoverageLineItem> adultCoverageLineItems = new ArrayList<>(); for (AdultCoverageLineItemDTO lineItemDTO : this.adultCoverageLineItems) { lineItemDTO.setModifiedBy(this.modifiedBy); adultCoverageLineItems.add(lineItemDTO.transform()); } List<OpenedVialLineItem> openedVialLineItems = new ArrayList<>(); for (OpenedVialLineItemDTO lineItemDTO : this.openedVialLineItems) { lineItemDTO.setModifiedBy(this.modifiedBy); openedVialLineItems.add(lineItemDTO.transform()); } adultCoverage.setAdultCoverageLineItems(adultCoverageLineItems); adultCoverage.setOpenedVialLineItems(openedVialLineItems); return adultCoverage; } }
AdultCoverageDTO extends BaseModel { public VaccinationAdultCoverage transform() { VaccinationAdultCoverage adultCoverage = new VaccinationAdultCoverage(); List<AdultCoverageLineItem> adultCoverageLineItems = new ArrayList<>(); for (AdultCoverageLineItemDTO lineItemDTO : this.adultCoverageLineItems) { lineItemDTO.setModifiedBy(this.modifiedBy); adultCoverageLineItems.add(lineItemDTO.transform()); } List<OpenedVialLineItem> openedVialLineItems = new ArrayList<>(); for (OpenedVialLineItemDTO lineItemDTO : this.openedVialLineItems) { lineItemDTO.setModifiedBy(this.modifiedBy); openedVialLineItems.add(lineItemDTO.transform()); } adultCoverage.setAdultCoverageLineItems(adultCoverageLineItems); adultCoverage.setOpenedVialLineItems(openedVialLineItems); return adultCoverage; }  }
AdultCoverageDTO extends BaseModel { public VaccinationAdultCoverage transform() { VaccinationAdultCoverage adultCoverage = new VaccinationAdultCoverage(); List<AdultCoverageLineItem> adultCoverageLineItems = new ArrayList<>(); for (AdultCoverageLineItemDTO lineItemDTO : this.adultCoverageLineItems) { lineItemDTO.setModifiedBy(this.modifiedBy); adultCoverageLineItems.add(lineItemDTO.transform()); } List<OpenedVialLineItem> openedVialLineItems = new ArrayList<>(); for (OpenedVialLineItemDTO lineItemDTO : this.openedVialLineItems) { lineItemDTO.setModifiedBy(this.modifiedBy); openedVialLineItems.add(lineItemDTO.transform()); } adultCoverage.setAdultCoverageLineItems(adultCoverageLineItems); adultCoverage.setOpenedVialLineItems(openedVialLineItems); return adultCoverage; }  VaccinationAdultCoverage transform(); }
AdultCoverageDTO extends BaseModel { public VaccinationAdultCoverage transform() { VaccinationAdultCoverage adultCoverage = new VaccinationAdultCoverage(); List<AdultCoverageLineItem> adultCoverageLineItems = new ArrayList<>(); for (AdultCoverageLineItemDTO lineItemDTO : this.adultCoverageLineItems) { lineItemDTO.setModifiedBy(this.modifiedBy); adultCoverageLineItems.add(lineItemDTO.transform()); } List<OpenedVialLineItem> openedVialLineItems = new ArrayList<>(); for (OpenedVialLineItemDTO lineItemDTO : this.openedVialLineItems) { lineItemDTO.setModifiedBy(this.modifiedBy); openedVialLineItems.add(lineItemDTO.transform()); } adultCoverage.setAdultCoverageLineItems(adultCoverageLineItems); adultCoverage.setOpenedVialLineItems(openedVialLineItems); return adultCoverage; }  VaccinationAdultCoverage transform();  }