use of org.mapstruct.ap.test.bugs._1269.dto.VehicleDto in project mapstruct by mapstruct.
the class Issue1269Test method shouldMapNestedPropertiesCorrectly.
@ProcessorTest
public void shouldMapNestedPropertiesCorrectly() {
VehicleTypeInfo sourceTypeInfo = new VehicleTypeInfo("Opel", "Corsa", 3);
List<VehicleImage> sourceImages = Arrays.asList(new VehicleImage(100, "something"), new VehicleImage(150, "somethingElse"));
Vehicle source = new Vehicle(sourceTypeInfo, sourceImages);
VehicleDto target = VehicleMapper.INSTANCE.map(source);
assertThat(target.getVehicleInfo()).isNotNull();
assertThat(target.getVehicleInfo().getDoors()).isEqualTo(3);
assertThat(target.getVehicleInfo().getType()).isEqualTo("Opel");
assertThat(target.getVehicleInfo().getName()).isEqualTo("Corsa");
assertThat(target.getVehicleInfo().getImages()).hasSize(2);
assertThat(target.getVehicleInfo().getImages().get(0)).isEqualToComparingFieldByField(sourceImages.get(0));
assertThat(target.getVehicleInfo().getImages().get(1)).isEqualToComparingFieldByField(sourceImages.get(1));
}
Aggregations