-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #145 from Elwizzy12/feature/setup-mapstruct-in-bac…
…kend Setup mapstruct into backend
- Loading branch information
Showing
5 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
power-pay-backend/src/test/java/com/adorsys/gis/powerpay/powerpaybackend/MapstructTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.adorsys.gis.powerpay.powerpaybackend; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
|
||
@SpringBootTest | ||
public class MapstructTest { | ||
|
||
@Test | ||
public void testmapStruct() { | ||
Person person = new Person(); | ||
person.setName("John Doe"); | ||
|
||
PersonDto personDto = PersonMapper.INSTANCE.personToPersonDto(person); | ||
|
||
System.out.println("Person DTO Full Name: " + personDto.getFullName()); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
power-pay-backend/src/test/java/com/adorsys/gis/powerpay/powerpaybackend/Person.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.adorsys.gis.powerpay.powerpaybackend; | ||
|
||
public class Person { | ||
private String name; | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
power-pay-backend/src/test/java/com/adorsys/gis/powerpay/powerpaybackend/PersonDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.adorsys.gis.powerpay.powerpaybackend; | ||
|
||
// PersonDto.java | ||
public class PersonDto { | ||
private String fullName; | ||
|
||
public String getFullName() { | ||
return fullName; | ||
} | ||
|
||
public void setFullName(String fullName) { | ||
this.fullName = fullName; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
power-pay-backend/src/test/java/com/adorsys/gis/powerpay/powerpaybackend/PersonMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.adorsys.gis.powerpay.powerpaybackend; | ||
|
||
// PersonMapper.java | ||
import org.mapstruct.Mapper; | ||
import org.mapstruct.Mapping; | ||
import org.mapstruct.factory.Mappers; | ||
|
||
@Mapper(componentModel = "spring") | ||
public interface PersonMapper { | ||
PersonMapper INSTANCE = Mappers.getMapper(PersonMapper.class); | ||
|
||
@Mapping(source = "name", target = "fullName") | ||
PersonDto personToPersonDto(Person person); | ||
} |