use of org.mapstruct.ap.test.complex.source.Person in project mapstruct by mapstruct.
the class CarMapperTest method shouldMapIterableAttribute.
@ProcessorTest
public void shouldMapIterableAttribute() {
// given
Car car = new Car("Morris", 2, new GregorianCalendar(1980, Calendar.JANUARY, 1).getTime(), new Person("Bob"), Arrays.asList(new Person("Alice"), new Person("Bill")));
// when
CarDto dto = CarMapper.INSTANCE.carToCarDto(car);
// then
assertThat(dto).isNotNull();
assertThat(dto.getPassengers()).hasSize(2);
assertThat(dto.getPassengers().get(0).getName()).isEqualTo("Alice");
assertThat(dto.getPassengers().get(1).getName()).isEqualTo("Bill");
}
Aggregations