Given this code:
data class From (
val nonNullProperty:String = "I'm not nullable",
val nullProperty:String? = null
)
@NoArgsConstructor
data class To(
val nonNullProperty: String,
val otherNonNullProperty: String = "I'm not nullable",
)
@Test
fun rien() {
val shapeshift = ShapeShiftBuilder().withMapping<From, To> {
autoMap(AutoMappingStrategy.BY_NAME)
From::nullProperty mappedTo To::otherNonNullProperty
}.build()
checkNotNull(shapeshift.map<From, To>(From()).otherNonNullProperty)
}
I would assume that the resulting object had otherNonNullProperty with its default value, but it seems using the no-arg constructor from noArg kotlin plugin does not honor default values.
Any way to work around this? I'd rather not use an ObjectSupplier if that would be possible, this seems tedious and error-prone.
FYI, if all the members of To have a default value, it works fine.
Given this code:
I would assume that the resulting object had
otherNonNullPropertywith its default value, but it seems using the no-arg constructor fromnoArgkotlin plugin does not honor default values.Any way to work around this? I'd rather not use an ObjectSupplier if that would be possible, this seems tedious and error-prone.
FYI, if all the members of
Tohave a default value, it works fine.