Search in sources :

Example 1 with VehicleTypeInfo

use of org.mapstruct.ap.test.bugs._1269.model.VehicleTypeInfo 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));
}
Also used : Vehicle(org.mapstruct.ap.test.bugs._1269.model.Vehicle) VehicleDto(org.mapstruct.ap.test.bugs._1269.dto.VehicleDto) VehicleImage(org.mapstruct.ap.test.bugs._1269.model.VehicleImage) VehicleTypeInfo(org.mapstruct.ap.test.bugs._1269.model.VehicleTypeInfo) ProcessorTest(org.mapstruct.ap.testutil.ProcessorTest)

Aggregations

VehicleDto (org.mapstruct.ap.test.bugs._1269.dto.VehicleDto)1 Vehicle (org.mapstruct.ap.test.bugs._1269.model.Vehicle)1 VehicleImage (org.mapstruct.ap.test.bugs._1269.model.VehicleImage)1 VehicleTypeInfo (org.mapstruct.ap.test.bugs._1269.model.VehicleTypeInfo)1 ProcessorTest (org.mapstruct.ap.testutil.ProcessorTest)1