use of org.mapstruct.ap.test.nullvaluemapping._target.CarDto in project mapstruct by mapstruct.
the class NullValueMappingTest method shouldMapExpressionAndConstantRegardlessOfIterableNullArgOnConfig.
@ProcessorTest
public void shouldMapExpressionAndConstantRegardlessOfIterableNullArgOnConfig() {
// when
CarDto carDto = CarMapperIterableSettingOnConfig.INSTANCE.carToCarDto(null);
// then
assertThat(carDto).isNotNull();
assertThat(carDto.getMake()).isNull();
assertThat(carDto.getSeatCount()).isEqualTo(0);
assertThat(carDto.getModel()).isEqualTo("ModelT");
assertThat(carDto.getCatalogId()).isNotEmpty();
}
use of org.mapstruct.ap.test.nullvaluemapping._target.CarDto in project mapstruct by mapstruct.
the class NullValueMappingTest method shouldMapExpressionAndConstantRegardlessMapNullArgOnMapper.
@ProcessorTest
public void shouldMapExpressionAndConstantRegardlessMapNullArgOnMapper() {
// when
CarDto carDto = CarMapperMapSettingOnMapper.INSTANCE.carToCarDto(null);
// then
assertThat(carDto).isNotNull();
assertThat(carDto.getMake()).isNull();
assertThat(carDto.getSeatCount()).isEqualTo(0);
assertThat(carDto.getModel()).isEqualTo("ModelT");
assertThat(carDto.getCatalogId()).isNotEmpty();
}
use of org.mapstruct.ap.test.nullvaluemapping._target.CarDto in project mapstruct by mapstruct.
the class NullValueMappingTest method shouldMapExpressionAndConstantRegardlessOfMapNullArgOnConfig.
@ProcessorTest
public void shouldMapExpressionAndConstantRegardlessOfMapNullArgOnConfig() {
// when
CarDto carDto = CarMapperMapSettingOnConfig.INSTANCE.carToCarDto(null);
// then
assertThat(carDto).isNotNull();
assertThat(carDto.getMake()).isNull();
assertThat(carDto.getSeatCount()).isEqualTo(0);
assertThat(carDto.getModel()).isEqualTo("ModelT");
assertThat(carDto.getCatalogId()).isNotEmpty();
}
use of org.mapstruct.ap.test.nullvaluemapping._target.CarDto in project mapstruct by mapstruct.
the class NullValueMappingTest method shouldMapExpressionAndConstantRegardlessNullArgOnConfig.
@ProcessorTest
public void shouldMapExpressionAndConstantRegardlessNullArgOnConfig() {
// when
CarDto carDto = CarMapperSettingOnConfig.INSTANCE.carToCarDto(null);
// then
assertThat(carDto).isNotNull();
assertThat(carDto.getMake()).isNull();
assertThat(carDto.getSeatCount()).isEqualTo(0);
assertThat(carDto.getModel()).isEqualTo("ModelT");
assertThat(carDto.getCatalogId()).isNotEmpty();
}
use of org.mapstruct.ap.test.nullvaluemapping._target.CarDto in project mapstruct by mapstruct.
the class CarMapperTest method shouldReverseMapIterableAttribute.
@ProcessorTest
public void shouldReverseMapIterableAttribute() {
// given
CarDto carDto = new CarDto("Morris", 2, "1980", new PersonDto("Bob"), Arrays.asList(new PersonDto("Alice"), new PersonDto("Bill")));
// when
Car car = CarMapper.INSTANCE.carDtoToCar(carDto);
// then
assertThat(car).isNotNull();
assertThat(car.getPassengers()).hasSize(2);
assertThat(car.getPassengers().get(0).getName()).isEqualTo("Alice");
assertThat(car.getPassengers().get(1).getName()).isEqualTo("Bill");
}
Aggregations