Fix indentation of Kotlin datamapping examples (#5563)

* Add Kotlin data mapping examples (BAEL-2247)

* Fix indentation in Kotlin datamapping examples
This commit is contained in:
Kevin Wittek 2018-10-29 16:02:38 +01:00 committed by Eugen
parent 758648eb05
commit 018e00c804
4 changed files with 26 additions and 26 deletions

View File

@ -1,10 +1,10 @@
package com.baeldung.datamapping
data class User(
val firstName: String,
val lastName: String,
val street: String,
val houseNumber: String,
val phone: String,
val age: Int,
val password: String)
val firstName: String,
val lastName: String,
val street: String,
val houseNumber: String,
val phone: String,
val age: Int,
val password: String)

View File

@ -3,10 +3,10 @@ package com.baeldung.datamapping
import kotlin.reflect.full.memberProperties
fun User.toUserView() = UserView(
name = "$firstName $lastName",
address = "$street $houseNumber",
telephone = phone,
age = age
name = "$firstName $lastName",
address = "$street $houseNumber",
telephone = phone,
age = age
)
fun User.toUserViewReflection() = with(::UserView) {

View File

@ -1,8 +1,8 @@
package com.baeldung.datamapping
data class UserView(
val name: String,
val address: String,
val telephone: String,
val age: Int
val name: String,
val address: String,
val telephone: String,
val age: Int
)

View File

@ -22,22 +22,22 @@ class UserTest {
private fun buildUser(): User {
return User(
"Java",
"Duke",
"Javastreet",
"42",
"1234567",
30,
"s3cr37"
"Java",
"Duke",
"Javastreet",
"42",
"1234567",
30,
"s3cr37"
)
}
private fun assertUserView(pr: UserView) {
assertAll(
{ assertEquals("Java Duke", pr.name) },
{ assertEquals("Javastreet 42", pr.address) },
{ assertEquals("1234567", pr.telephone) },
{ assertEquals(30, pr.age) }
{ assertEquals("Java Duke", pr.name) },
{ assertEquals("Javastreet 42", pr.address) },
{ assertEquals("1234567", pr.telephone) },
{ assertEquals(30, pr.age) }
)
}
}