Search in sources :

Example 6 with CustomerEntity

use of org.mapstruct.ap.test.injectionstrategy.shared.CustomerEntity in project mapstruct by mapstruct.

the class Jsr330CompileOptionConstructorMapperTest method shouldConvertToTarget.

@ProcessorTest
public void shouldConvertToTarget() {
    // given
    CustomerEntity customerEntity = new CustomerEntity();
    customerEntity.setName("Samuel");
    customerEntity.setGender(Gender.MALE);
    // when
    CustomerDto customerDto = customerMapper.asTarget(customerEntity);
    // then
    assertThat(customerDto).isNotNull();
    assertThat(customerDto.getName()).isEqualTo("Samuel");
    assertThat(customerDto.getGender()).isEqualTo(GenderDto.M);
}
Also used : CustomerEntity(org.mapstruct.ap.test.injectionstrategy.shared.CustomerEntity) CustomerDto(org.mapstruct.ap.test.injectionstrategy.shared.CustomerDto) ProcessorTest(org.mapstruct.ap.testutil.ProcessorTest)

Example 7 with CustomerEntity

use of org.mapstruct.ap.test.injectionstrategy.shared.CustomerEntity in project mapstruct by mapstruct.

the class Jsr330FieldMapperTest method shouldConvertToTarget.

@ProcessorTest
public void shouldConvertToTarget() {
    // given
    CustomerEntity customerEntity = new CustomerEntity();
    customerEntity.setName("Samuel");
    customerEntity.setGender(Gender.MALE);
    // when
    CustomerDto customerDto = customerMapper.asTarget(customerEntity);
    // then
    assertThat(customerDto).isNotNull();
    assertThat(customerDto.getName()).isEqualTo("Samuel");
    assertThat(customerDto.getGender()).isEqualTo(GenderDto.M);
}
Also used : CustomerEntity(org.mapstruct.ap.test.injectionstrategy.shared.CustomerEntity) CustomerDto(org.mapstruct.ap.test.injectionstrategy.shared.CustomerDto) ProcessorTest(org.mapstruct.ap.testutil.ProcessorTest)

Example 8 with CustomerEntity

use of org.mapstruct.ap.test.injectionstrategy.shared.CustomerEntity in project mapstruct by mapstruct.

the class SpringDefaultMapperTest method shouldConvertToTarget.

@ProcessorTest
public void shouldConvertToTarget() {
    // given
    CustomerEntity customerEntity = new CustomerEntity();
    customerEntity.setName("Samuel");
    customerEntity.setGender(Gender.MALE);
    // when
    CustomerDto customerDto = customerMapper.asTarget(customerEntity);
    // then
    assertThat(customerDto).isNotNull();
    assertThat(customerDto.getName()).isEqualTo("Samuel");
    assertThat(customerDto.getGender()).isEqualTo(GenderDto.M);
}
Also used : CustomerEntity(org.mapstruct.ap.test.injectionstrategy.shared.CustomerEntity) CustomerDto(org.mapstruct.ap.test.injectionstrategy.shared.CustomerDto) ProcessorTest(org.mapstruct.ap.testutil.ProcessorTest)

Aggregations

CustomerEntity (org.mapstruct.ap.test.injectionstrategy.shared.CustomerEntity)8 ProcessorTest (org.mapstruct.ap.testutil.ProcessorTest)8 CustomerDto (org.mapstruct.ap.test.injectionstrategy.shared.CustomerDto)6 CustomerRecordDto (org.mapstruct.ap.test.injectionstrategy.shared.CustomerRecordDto)2 CustomerRecordEntity (org.mapstruct.ap.test.injectionstrategy.shared.CustomerRecordEntity)2