@Test public void shouldTransformDTOIntoRealObject() throws Exception { FacilityVisit facilityVisit = new FacilityVisit(); EpiUseDTO epiUseDTO = mock(EpiUseDTO.class); DistributionRefrigeratorsDTO distributionRefrigeratorsDTO = mock(DistributionRefrigeratorsDTO.class); VaccinationFullCoverageDTO coverageDTO = mock(VaccinationFullCoverageDTO.class); EpiInventoryDTO epiInventoryDTO = mock(EpiInventoryDTO.class); ChildCoverageDTO childCoverageDTO = mock(ChildCoverageDTO.class); AdultCoverageDTO adultCoverageDTO = mock(AdultCoverageDTO.class); FacilityDistributionDTO facilityDistributionDTO = new FacilityDistributionDTO(facilityVisit, epiUseDTO, epiInventoryDTO, distributionRefrigeratorsDTO, coverageDTO, childCoverageDTO, adultCoverageDTO); EpiUse epiUse = new EpiUse(); when(epiUseDTO.transform()).thenReturn(epiUse); DistributionRefrigerators distributionRefrigerators = mock(DistributionRefrigerators.class); when(distributionRefrigeratorsDTO.transform()).thenReturn(distributionRefrigerators); VaccinationFullCoverage vaccinationFullCoverage = new VaccinationFullCoverage(); when(coverageDTO.transform()).thenReturn(vaccinationFullCoverage); EpiInventory epiInventory = new EpiInventory(); when(epiInventoryDTO.transform()).thenReturn(epiInventory); VaccinationChildCoverage childCoverage = new VaccinationChildCoverage(); when(childCoverageDTO.transform()).thenReturn(childCoverage); VaccinationAdultCoverage adultCoverage = new VaccinationAdultCoverage(); when(adultCoverageDTO.transform()).thenReturn(adultCoverage); FacilityDistribution facilityDistribution = facilityDistributionDTO.transform(); assertThat(facilityDistribution.getFacilityVisit(), is(facilityDistributionDTO.getFacilityVisit())); assertThat(facilityDistribution.getEpiUse(), is(epiUse)); assertThat(facilityDistribution.getRefrigerators(), is(distributionRefrigerators)); assertThat(facilityDistribution.getFullCoverage(), is(vaccinationFullCoverage)); assertThat(facilityDistribution.getEpiInventory(), is(epiInventory)); assertThat(facilityDistribution.getChildCoverage(), is(childCoverage)); assertThat(facilityDistribution.getAdultCoverage(), is(adultCoverage)); }
public FacilityDistribution transform() { return new FacilityDistribution(facilityVisit, epiUse.transform(), refrigerators.transform(), epiInventory.transform(), fullCoverage.transform(), childCoverage.transform(), adultCoverage.transform()); }
FacilityDistributionDTO { public FacilityDistribution transform() { return new FacilityDistribution(facilityVisit, epiUse.transform(), refrigerators.transform(), epiInventory.transform(), fullCoverage.transform(), childCoverage.transform(), adultCoverage.transform()); } }
FacilityDistributionDTO { public FacilityDistribution transform() { return new FacilityDistribution(facilityVisit, epiUse.transform(), refrigerators.transform(), epiInventory.transform(), fullCoverage.transform(), childCoverage.transform(), adultCoverage.transform()); }  }
FacilityDistributionDTO { public FacilityDistribution transform() { return new FacilityDistribution(facilityVisit, epiUse.transform(), refrigerators.transform(), epiInventory.transform(), fullCoverage.transform(), childCoverage.transform(), adultCoverage.transform()); }  FacilityDistribution transform(); void setDistributionId(Long distributionId); void setModifiedBy(Long modifiedBy); }
FacilityDistributionDTO { public FacilityDistribution transform() { return new FacilityDistribution(facilityVisit, epiUse.transform(), refrigerators.transform(), epiInventory.transform(), fullCoverage.transform(), childCoverage.transform(), adultCoverage.transform()); }  FacilityDistribution transform(); void setDistributionId(Long distributionId); void setModifiedBy(Long modifiedBy);  }