formatted the source code

This commit is contained in:
jesus-dayo 2016-08-19 10:28:02 +08:00
parent f0947ae8fb
commit e9925d390c
3 changed files with 7 additions and 13 deletions

View File

@ -13,14 +13,10 @@ import org.mapstruct.Mappings;
@Mapper @Mapper
public interface EmployeeMapper { public interface EmployeeMapper {
@Mappings({ @Mapping(target = "employeeId", source = "entity.id"), @Mappings({ @Mapping(target = "employeeId", source = "entity.id"), @Mapping(target = "employeeName", source = "entity.name"), @Mapping(target = "employeeStartDt", source = "entity.startDt", dateFormat = "dd-MM-yyyy HH:mm:ss") })
@Mapping(target = "employeeName", source = "entity.name"),
@Mapping(target = "employeeStartDt",source = "entity.startDt", dateFormat = "dd-MM-yyyy HH:mm:ss")})
EmployeeDTO employeeToEmployeeDTO(Employee entity); EmployeeDTO employeeToEmployeeDTO(Employee entity);
@Mappings({ @Mapping(target = "id", source = "dto.employeeId"), @Mappings({ @Mapping(target = "id", source = "dto.employeeId"), @Mapping(target = "name", source = "dto.employeeName"), @Mapping(target = "startDt", source = "dto.employeeStartDt", dateFormat = "dd-MM-yyyy HH:mm:ss") })
@Mapping(target = "name", source = "dto.employeeName"),
@Mapping(target = "startDt",source = "dto.employeeStartDt", dateFormat = "dd-MM-yyyy HH:mm:ss")})
Employee employeeDTOtoEmployee(EmployeeDTO dto); Employee employeeDTOtoEmployee(EmployeeDTO dto);
DivisionDTO divisionToDivisionDTO(Division entity); DivisionDTO divisionToDivisionDTO(Division entity);

View File

@ -18,7 +18,7 @@ import org.mapstruct.factory.Mappers;
public class EmployeeMapperTest { public class EmployeeMapperTest {
EmployeeMapper mapper = Mappers.getMapper(EmployeeMapper.class); EmployeeMapper mapper = Mappers.getMapper(EmployeeMapper.class);
private static final String DATE_FORMAT = "dd-MM-yyyy HH:mm:ss"; private static final String DATE_FORMAT = "dd-MM-yyyy HH:mm:ss";
@Test @Test
@ -108,10 +108,9 @@ public class EmployeeMapperTest {
EmployeeDTO dto = mapper.employeeToEmployeeDTO(entity); EmployeeDTO dto = mapper.employeeToEmployeeDTO(entity);
SimpleDateFormat format = new SimpleDateFormat(DATE_FORMAT); SimpleDateFormat format = new SimpleDateFormat(DATE_FORMAT);
assertEquals(format.parse(dto.getEmployeeStartDt()).toString(), assertEquals(format.parse(dto.getEmployeeStartDt()).toString(), entity.getStartDt().toString());
entity.getStartDt().toString());
} }
@Test @Test
public void givenEmployeeDTOWithStartDateMappingToEmployee_whenMaps_thenCorrect() throws ParseException { public void givenEmployeeDTOWithStartDateMappingToEmployee_whenMaps_thenCorrect() throws ParseException {
EmployeeDTO dto = new EmployeeDTO(); EmployeeDTO dto = new EmployeeDTO();
@ -119,7 +118,6 @@ public class EmployeeMapperTest {
Employee entity = mapper.employeeDTOtoEmployee(dto); Employee entity = mapper.employeeDTOtoEmployee(dto);
SimpleDateFormat format = new SimpleDateFormat(DATE_FORMAT); SimpleDateFormat format = new SimpleDateFormat(DATE_FORMAT);
assertEquals(format.parse(dto.getEmployeeStartDt()).toString(), assertEquals(format.parse(dto.getEmployeeStartDt()).toString(), entity.getStartDt().toString());
entity.getStartDt().toString());
} }
} }

View File

@ -16,7 +16,7 @@ public class SimpleSourceDestinationMapperTest {
@Autowired @Autowired
SimpleSourceDestinationMapper simpleSourceDestinationMapper; SimpleSourceDestinationMapper simpleSourceDestinationMapper;
@Test @Test
public void givenSimpleSourceToSimpleDestination_whenMaps_thenCorrect() { public void givenSimpleSourceToSimpleDestination_whenMaps_thenCorrect() {
SimpleSource simpleSource = new SimpleSource(); SimpleSource simpleSource = new SimpleSource();