Search in sources :

Example 1 with Address

use of org.mapstruct.ap.test.decorator.Address in project mapstruct by mapstruct.

the class SpringDecoratorTest method shouldDelegateNonDecoratedMethodsToDefaultImplementation.

@ProcessorTest
public void shouldDelegateNonDecoratedMethodsToDefaultImplementation() {
    // given
    Address address = new Address("42 Ocean View Drive");
    // when
    AddressDto addressDto = personMapper.addressToAddressDto(address);
    // then
    assertThat(addressDto).isNotNull();
    assertThat(addressDto.getAddressLine()).isEqualTo("42 Ocean View Drive");
}
Also used : Address(org.mapstruct.ap.test.decorator.Address) AddressDto(org.mapstruct.ap.test.decorator.AddressDto) ProcessorTest(org.mapstruct.ap.testutil.ProcessorTest)

Example 2 with Address

use of org.mapstruct.ap.test.decorator.Address in project mapstruct by mapstruct.

the class SpringDecoratorTest method shouldDelegateNonDecoratedMethodsToDefaultImplementation.

@ProcessorTest
public void shouldDelegateNonDecoratedMethodsToDefaultImplementation() {
    // given
    Address address = new Address("42 Ocean View Drive");
    // when
    AddressDto addressDto = personMapper.addressToAddressDto(address);
    // then
    assertThat(addressDto).isNotNull();
    assertThat(addressDto.getAddressLine()).isEqualTo("42 Ocean View Drive");
}
Also used : Address(org.mapstruct.ap.test.decorator.Address) AddressDto(org.mapstruct.ap.test.decorator.AddressDto) ProcessorTest(org.mapstruct.ap.testutil.ProcessorTest)

Example 3 with Address

use of org.mapstruct.ap.test.decorator.Address in project mapstruct by mapstruct.

the class SpringDecoratorTest method shouldInvokeDecoratorMethods.

@ProcessorTest
public void shouldInvokeDecoratorMethods() {
    // given
    Calendar birthday = Calendar.getInstance();
    birthday.set(1928, Calendar.MAY, 23);
    Person person = new Person("Gary", "Crant", birthday.getTime(), new Address("42 Ocean View Drive"));
    // when
    PersonDto personDto = personMapper.personToPersonDto(person);
    // then
    assertThat(personDto).isNotNull();
    assertThat(personDto.getName()).isEqualTo("Gary Crant");
    assertThat(personDto.getAddress()).isNotNull();
    assertThat(personDto.getAddress().getAddressLine()).isEqualTo("42 Ocean View Drive");
}
Also used : Address(org.mapstruct.ap.test.decorator.Address) PersonDto(org.mapstruct.ap.test.decorator.PersonDto) Calendar(java.util.Calendar) Person(org.mapstruct.ap.test.decorator.Person) ProcessorTest(org.mapstruct.ap.testutil.ProcessorTest)

Example 4 with Address

use of org.mapstruct.ap.test.decorator.Address in project mapstruct by mapstruct.

the class Jsr330DecoratorTest method shouldInvokeDecoratorMethods.

@ProcessorTest
public void shouldInvokeDecoratorMethods() {
    Calendar birthday = Calendar.getInstance();
    birthday.set(1928, Calendar.MAY, 23);
    Person person = new Person("Gary", "Crant", birthday.getTime(), new Address("42 Ocean View Drive"));
    PersonDto personDto = personMapper.personToPersonDto(person);
    assertThat(personDto).isNotNull();
    assertThat(personDto.getName()).isEqualTo("Gary Crant");
    assertThat(personDto.getAddress()).isNotNull();
    assertThat(personDto.getAddress().getAddressLine()).isEqualTo("42 Ocean View Drive");
}
Also used : Address(org.mapstruct.ap.test.decorator.Address) PersonDto(org.mapstruct.ap.test.decorator.PersonDto) Calendar(java.util.Calendar) Person(org.mapstruct.ap.test.decorator.Person) ProcessorTest(org.mapstruct.ap.testutil.ProcessorTest)

Example 5 with Address

use of org.mapstruct.ap.test.decorator.Address in project mapstruct by mapstruct.

the class Jsr330DecoratorTest method shouldDelegateNonDecoratedMethodsToDefaultImplementation.

@ProcessorTest
public void shouldDelegateNonDecoratedMethodsToDefaultImplementation() {
    Address address = new Address("42 Ocean View Drive");
    AddressDto addressDto = personMapper.addressToAddressDto(address);
    assertThat(addressDto).isNotNull();
    assertThat(addressDto.getAddressLine()).isEqualTo("42 Ocean View Drive");
}
Also used : Address(org.mapstruct.ap.test.decorator.Address) AddressDto(org.mapstruct.ap.test.decorator.AddressDto) ProcessorTest(org.mapstruct.ap.testutil.ProcessorTest)

Aggregations

Address (org.mapstruct.ap.test.decorator.Address)6 ProcessorTest (org.mapstruct.ap.testutil.ProcessorTest)6 Calendar (java.util.Calendar)3 AddressDto (org.mapstruct.ap.test.decorator.AddressDto)3 Person (org.mapstruct.ap.test.decorator.Person)3 PersonDto (org.mapstruct.ap.test.decorator.PersonDto)3