use of org.mapstruct.ap.testutil.IssueKey in project mapstruct by mapstruct.
the class ExternalSelectionTest method shouldSelectGeneratedExternalMapperForIterablesAndMaps.
@ProcessorTest
@IssueKey("487")
public void shouldSelectGeneratedExternalMapperForIterablesAndMaps() {
DepartmentDto departmentDto = new DepartmentDto();
EmployeeDto employeeDto = new EmployeeDto();
employeeDto.setName("Sarah");
SecretaryDto secretaryDto = new SecretaryDto();
secretaryDto.setName("Jim");
departmentDto.setEmployees(Arrays.asList(employeeDto));
Map<SecretaryDto, EmployeeDto> secretaryToEmployee = new HashMap<>();
secretaryToEmployee.put(secretaryDto, employeeDto);
departmentDto.setSecretaryToEmployee(secretaryToEmployee);
DepartmentEntity departmentEntity = new DepartmentEntity(5);
DepartmentMapper.INSTANCE.toDepartmentEntity(departmentDto, departmentEntity);
assertThat(departmentEntity).isNotNull();
assertThat(departmentEntity.getEmployees()).isNotEmpty();
assertThat(departmentEntity.getEmployees().get(0).getName()).isEqualTo("Sarah");
assertThat(departmentEntity.getSecretaryToEmployee()).isNotEmpty();
Map.Entry<SecretaryEntity, EmployeeEntity> firstEntry = departmentEntity.getSecretaryToEmployee().entrySet().iterator().next();
assertThat(firstEntry.getKey().getName()).isEqualTo("Jim");
assertThat(firstEntry.getValue().getName()).isEqualTo("Sarah");
}
use of org.mapstruct.ap.testutil.IssueKey in project mapstruct by mapstruct.
the class ExternalSelectionTest method shouldSelectGeneratedExternalMapperWithImportForPropertyType.
@ProcessorTest
@WithClasses({ OrganizationMapper3.class })
@IssueKey("604")
public void shouldSelectGeneratedExternalMapperWithImportForPropertyType() {
generatedSource.addComparisonToFixtureFor(OrganizationMapper3.class);
BossEntity entity = new BossEntity();
BossDto dto = new BossDto();
OrganizationMapper3.INSTANCE.toBossEntity(dto, entity);
}
use of org.mapstruct.ap.testutil.IssueKey in project mapstruct by mapstruct.
the class EnumToEnumMappingTest method shouldMapAnyRemainingToNullCorrectly.
@IssueKey("1091")
@ProcessorTest
public void shouldMapAnyRemainingToNullCorrectly() {
ExternalOrderType externalOrderType = SpecialOrderMapper.INSTANCE.anyRemainingToNull(OrderType.RETAIL);
assertThat(externalOrderType).isNotNull().isEqualTo(ExternalOrderType.RETAIL);
externalOrderType = SpecialOrderMapper.INSTANCE.anyRemainingToNull(OrderType.B2B);
assertThat(externalOrderType).isNotNull().isEqualTo(ExternalOrderType.B2B);
externalOrderType = SpecialOrderMapper.INSTANCE.anyRemainingToNull(OrderType.EXTRA);
assertThat(externalOrderType).isNull();
externalOrderType = SpecialOrderMapper.INSTANCE.anyRemainingToNull(OrderType.STANDARD);
assertThat(externalOrderType).isNull();
externalOrderType = SpecialOrderMapper.INSTANCE.anyRemainingToNull(OrderType.NORMAL);
assertThat(externalOrderType).isNull();
}
Aggregations