From e9925d390ca8501f15181d58c543ee7c8975e9cd Mon Sep 17 00:00:00 2001 From: jesus-dayo Date: Fri, 19 Aug 2016 10:28:02 +0800 Subject: [PATCH] formatted the source code --- .../main/java/org/baeldung/mapper/EmployeeMapper.java | 8 ++------ .../java/org/baeldung/mapper/EmployeeMapperTest.java | 10 ++++------ .../mapper/SimpleSourceDestinationMapperTest.java | 2 +- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/mapstruct/src/main/java/org/baeldung/mapper/EmployeeMapper.java b/mapstruct/src/main/java/org/baeldung/mapper/EmployeeMapper.java index ba1b68f5d9..013c332e6e 100644 --- a/mapstruct/src/main/java/org/baeldung/mapper/EmployeeMapper.java +++ b/mapstruct/src/main/java/org/baeldung/mapper/EmployeeMapper.java @@ -13,14 +13,10 @@ import org.mapstruct.Mappings; @Mapper public interface EmployeeMapper { - @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")}) + @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") }) EmployeeDTO employeeToEmployeeDTO(Employee entity); - @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")}) + @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") }) Employee employeeDTOtoEmployee(EmployeeDTO dto); DivisionDTO divisionToDivisionDTO(Division entity); diff --git a/mapstruct/src/test/java/org/baeldung/mapper/EmployeeMapperTest.java b/mapstruct/src/test/java/org/baeldung/mapper/EmployeeMapperTest.java index 9111a2c198..c5998f89ef 100644 --- a/mapstruct/src/test/java/org/baeldung/mapper/EmployeeMapperTest.java +++ b/mapstruct/src/test/java/org/baeldung/mapper/EmployeeMapperTest.java @@ -18,7 +18,7 @@ import org.mapstruct.factory.Mappers; public class EmployeeMapperTest { EmployeeMapper mapper = Mappers.getMapper(EmployeeMapper.class); - + private static final String DATE_FORMAT = "dd-MM-yyyy HH:mm:ss"; @Test @@ -108,10 +108,9 @@ public class EmployeeMapperTest { EmployeeDTO dto = mapper.employeeToEmployeeDTO(entity); SimpleDateFormat format = new SimpleDateFormat(DATE_FORMAT); - assertEquals(format.parse(dto.getEmployeeStartDt()).toString(), - entity.getStartDt().toString()); + assertEquals(format.parse(dto.getEmployeeStartDt()).toString(), entity.getStartDt().toString()); } - + @Test public void givenEmployeeDTOWithStartDateMappingToEmployee_whenMaps_thenCorrect() throws ParseException { EmployeeDTO dto = new EmployeeDTO(); @@ -119,7 +118,6 @@ public class EmployeeMapperTest { Employee entity = mapper.employeeDTOtoEmployee(dto); SimpleDateFormat format = new SimpleDateFormat(DATE_FORMAT); - assertEquals(format.parse(dto.getEmployeeStartDt()).toString(), - entity.getStartDt().toString()); + assertEquals(format.parse(dto.getEmployeeStartDt()).toString(), entity.getStartDt().toString()); } } diff --git a/mapstruct/src/test/java/org/baeldung/mapper/SimpleSourceDestinationMapperTest.java b/mapstruct/src/test/java/org/baeldung/mapper/SimpleSourceDestinationMapperTest.java index 0cc072788b..226603b16a 100644 --- a/mapstruct/src/test/java/org/baeldung/mapper/SimpleSourceDestinationMapperTest.java +++ b/mapstruct/src/test/java/org/baeldung/mapper/SimpleSourceDestinationMapperTest.java @@ -16,7 +16,7 @@ public class SimpleSourceDestinationMapperTest { @Autowired SimpleSourceDestinationMapper simpleSourceDestinationMapper; - + @Test public void givenSimpleSourceToSimpleDestination_whenMaps_thenCorrect() { SimpleSource simpleSource = new SimpleSource();