Search in sources :

Example 1 with CustomerDto

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

the class Jsr330ConstructorMapperTest 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 2 with CustomerDto

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

the class Jsr330DefaultCompileOptionFieldMapperTest 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 3 with CustomerDto

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

the class SpringFieldMapperTest 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 4 with CustomerDto

use of org.mapstruct.ap.test.injectionstrategy.shared.CustomerDto 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 5 with CustomerDto

use of org.mapstruct.ap.test.injectionstrategy.shared.CustomerDto 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)

Aggregations

CustomerDto (org.mapstruct.ap.test.injectionstrategy.shared.CustomerDto)6 CustomerEntity (org.mapstruct.ap.test.injectionstrategy.shared.CustomerEntity)6 ProcessorTest (org.mapstruct.ap.testutil.ProcessorTest)6