use of org.mapstruct.ap.test.decorator.PersonDto in project mapstruct by mapstruct.
the class PersonMapperDecorator method personToPersonDto.
@Override
public PersonDto personToPersonDto(Person person) {
PersonDto dto = delegate.personToPersonDto(person);
dto.setName(person.getFirstName() + " " + person.getLastName());
return dto;
}
use of org.mapstruct.ap.test.decorator.PersonDto 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");
}
use of org.mapstruct.ap.test.decorator.PersonDto in project mapstruct by mapstruct.
the class PersonMapperDecorator method personToPersonDto.
@Override
public PersonDto personToPersonDto(Person person) {
PersonDto dto = delegate.personToPersonDto(person);
dto.setName(person.getFirstName() + " " + person.getLastName());
return dto;
}
use of org.mapstruct.ap.test.decorator.PersonDto 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");
}
use of org.mapstruct.ap.test.decorator.PersonDto in project mapstruct by mapstruct.
the class PersonMapperDecorator method personToPersonDto.
@Override
public PersonDto personToPersonDto(Person person) {
PersonDto dto = delegate.personToPersonDto(person);
dto.setName(person.getFirstName() + " " + person.getLastName());
return dto;
}
Aggregations