-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for selecting nested properties (#27)
- Loading branch information
1 parent
5402e6d
commit 9efe4cc
Showing
11 changed files
with
77 additions
and
19 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
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
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
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
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
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
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
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,15 @@ | ||
package testing | ||
|
||
import tech.mappie.api.ObjectMappie | ||
|
||
data class NestedInput(val input: NestedInputValue) | ||
|
||
data class NestedInputValue(val value: String) | ||
|
||
data class NestedOutput(val value: String) | ||
|
||
object NestedPropertyMapper : ObjectMappie<NestedInput, NestedOutput>() { | ||
override fun map(from: NestedInput): NestedOutput = mapping { | ||
NestedOutput::value fromProperty from.input::value | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
testing/src/test/kotlin/testing/NestedPropertyMapperTest.kt
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,15 @@ | ||
package testing | ||
|
||
import org.junit.jupiter.api.Test | ||
import kotlin.test.assertEquals | ||
|
||
class NestedPropertyMapperTest { | ||
|
||
@Test | ||
fun `map NestedInput to NestedOutput via NestedPropertyMapper`() { | ||
assertEquals( | ||
NestedOutput("Test"), | ||
NestedPropertyMapper.map(NestedInput(NestedInputValue("Test"))) | ||
) | ||
} | ||
} |
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
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