@Test public void shouldTransformRefrigeratorsDTOIntoRefrigerators() throws Exception { RefrigeratorReadingDTO refrigeratorReadingDTO1 = mock(RefrigeratorReadingDTO.class); RefrigeratorReadingDTO refrigeratorReadingDTO2 = mock(RefrigeratorReadingDTO.class); RefrigeratorReading reading1 = new RefrigeratorReading(); RefrigeratorReading reading2 = new RefrigeratorReading(); when(refrigeratorReadingDTO1.transform()).thenReturn(reading1); when(refrigeratorReadingDTO2.transform()).thenReturn(reading2); List<RefrigeratorReadingDTO> readings = asList(refrigeratorReadingDTO1, refrigeratorReadingDTO2); DistributionRefrigeratorsDTO refrigeratorsDTO = new DistributionRefrigeratorsDTO(readings); refrigeratorsDTO.transform(); verify(refrigeratorReadingDTO1).transform(); verify(refrigeratorReadingDTO2).transform(); }
public DistributionRefrigerators transform() { List<RefrigeratorReading> refrigeratorReadings = new ArrayList<>(); final Long createdBy = this.createdBy; final Long modifiedBy = this.modifiedBy; if (readings != null) { refrigeratorReadings = (List) collect(readings, new Transformer() { @Override public Object transform(Object o) { RefrigeratorReadingDTO readingDTO = (RefrigeratorReadingDTO) o; readingDTO.setCreatedBy(createdBy); readingDTO.setModifiedBy(modifiedBy); RefrigeratorReading reading = readingDTO.transform(); return reading; } }); } return new DistributionRefrigerators(refrigeratorReadings); }
DistributionRefrigeratorsDTO extends BaseModel { public DistributionRefrigerators transform() { List<RefrigeratorReading> refrigeratorReadings = new ArrayList<>(); final Long createdBy = this.createdBy; final Long modifiedBy = this.modifiedBy; if (readings != null) { refrigeratorReadings = (List) collect(readings, new Transformer() { @Override public Object transform(Object o) { RefrigeratorReadingDTO readingDTO = (RefrigeratorReadingDTO) o; readingDTO.setCreatedBy(createdBy); readingDTO.setModifiedBy(modifiedBy); RefrigeratorReading reading = readingDTO.transform(); return reading; } }); } return new DistributionRefrigerators(refrigeratorReadings); } }
DistributionRefrigeratorsDTO extends BaseModel { public DistributionRefrigerators transform() { List<RefrigeratorReading> refrigeratorReadings = new ArrayList<>(); final Long createdBy = this.createdBy; final Long modifiedBy = this.modifiedBy; if (readings != null) { refrigeratorReadings = (List) collect(readings, new Transformer() { @Override public Object transform(Object o) { RefrigeratorReadingDTO readingDTO = (RefrigeratorReadingDTO) o; readingDTO.setCreatedBy(createdBy); readingDTO.setModifiedBy(modifiedBy); RefrigeratorReading reading = readingDTO.transform(); return reading; } }); } return new DistributionRefrigerators(refrigeratorReadings); }  }
DistributionRefrigeratorsDTO extends BaseModel { public DistributionRefrigerators transform() { List<RefrigeratorReading> refrigeratorReadings = new ArrayList<>(); final Long createdBy = this.createdBy; final Long modifiedBy = this.modifiedBy; if (readings != null) { refrigeratorReadings = (List) collect(readings, new Transformer() { @Override public Object transform(Object o) { RefrigeratorReadingDTO readingDTO = (RefrigeratorReadingDTO) o; readingDTO.setCreatedBy(createdBy); readingDTO.setModifiedBy(modifiedBy); RefrigeratorReading reading = readingDTO.transform(); return reading; } }); } return new DistributionRefrigerators(refrigeratorReadings); }  DistributionRefrigerators transform(); }
DistributionRefrigeratorsDTO extends BaseModel { public DistributionRefrigerators transform() { List<RefrigeratorReading> refrigeratorReadings = new ArrayList<>(); final Long createdBy = this.createdBy; final Long modifiedBy = this.modifiedBy; if (readings != null) { refrigeratorReadings = (List) collect(readings, new Transformer() { @Override public Object transform(Object o) { RefrigeratorReadingDTO readingDTO = (RefrigeratorReadingDTO) o; readingDTO.setCreatedBy(createdBy); readingDTO.setModifiedBy(modifiedBy); RefrigeratorReading reading = readingDTO.transform(); return reading; } }); } return new DistributionRefrigerators(refrigeratorReadings); }  DistributionRefrigerators transform();  }