use of org.mapstruct.ap.test.injectionstrategy.shared.CustomerRecordDto in project mapstruct by mapstruct.
the class SpringCompileOptionConstructorMapperTest method shouldConvertToTarget.
@ProcessorTest
public void shouldConvertToTarget() throws Exception {
// given
CustomerEntity customerEntity = new CustomerEntity();
customerEntity.setName("Samuel");
customerEntity.setGender(Gender.MALE);
CustomerRecordEntity customerRecordEntity = new CustomerRecordEntity();
customerRecordEntity.setCustomer(customerEntity);
customerRecordEntity.setRegistrationDate(createDate("31-08-1982 10:20:56"));
// when
CustomerRecordDto customerRecordDto = customerRecordMapper.asTarget(customerRecordEntity);
// then
assertThat(customerRecordDto).isNotNull();
assertThat(customerRecordDto.getCustomer()).isNotNull();
assertThat(customerRecordDto.getCustomer().getName()).isEqualTo("Samuel");
assertThat(customerRecordDto.getCustomer().getGender()).isEqualTo(GenderDto.M);
assertThat(customerRecordDto.getRegistrationDate()).isNotNull();
assertThat(customerRecordDto.getRegistrationDate().toString()).isEqualTo("1982-08-31T10:20:56.000+02:00");
}
use of org.mapstruct.ap.test.injectionstrategy.shared.CustomerRecordDto in project mapstruct by mapstruct.
the class SpringConstructorMapperTest method shouldConvertToTarget.
@ProcessorTest
public void shouldConvertToTarget() throws Exception {
// given
CustomerEntity customerEntity = new CustomerEntity();
customerEntity.setName("Samuel");
customerEntity.setGender(Gender.MALE);
CustomerRecordEntity customerRecordEntity = new CustomerRecordEntity();
customerRecordEntity.setCustomer(customerEntity);
customerRecordEntity.setRegistrationDate(createDate("31-08-1982 10:20:56"));
// when
CustomerRecordDto customerRecordDto = customerRecordMapper.asTarget(customerRecordEntity);
// then
assertThat(customerRecordDto).isNotNull();
assertThat(customerRecordDto.getCustomer()).isNotNull();
assertThat(customerRecordDto.getCustomer().getName()).isEqualTo("Samuel");
assertThat(customerRecordDto.getCustomer().getGender()).isEqualTo(GenderDto.M);
assertThat(customerRecordDto.getRegistrationDate()).isNotNull();
assertThat(customerRecordDto.getRegistrationDate().toString()).isEqualTo("1982-08-31T10:20:56.000+02:00");
}
Aggregations