Skip to content

Commit

Permalink
add support for mapped lists
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddenton committed Jan 4, 2024
1 parent c6be55e commit 2cd0db4
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ interface MainClassFields<T : SubClassFields> {
var listSubClassField: List<T>
var listIntsField: List<Int>
var listValueField: List<MyType>
val listMapped: List<String>

var objectField: T

Expand Down Expand Up @@ -166,6 +167,7 @@ abstract class DataContainerContract<T : SubClassFields> {
mapOf(
"listField" to listOf("string1", "string2"),
"listIntsField" to listOf(1, 2, 3),
"listMapped" to listOf(123, 456),
"listValueField" to listOf(1, 2, 3),
"listSubClassField" to listOf(
mapOf("stringField" to "string1"),
Expand All @@ -175,6 +177,7 @@ abstract class DataContainerContract<T : SubClassFields> {
)
)
expectThat(input.listField).isEqualTo(listOf("string1", "string2"))
expectThat(input.listMapped).isEqualTo(listOf("123", "456"))
expectThat(input.listIntsField).isEqualTo(listOf(1, 2, 3))
expectThat(input.listValueField).isEqualTo(listOf(1, 2, 3).map(MyType::of))
expectThat(input.listSubClassField.map { it.stringField }).isEqualTo(listOf("string1", "string2"))
Expand Down

0 comments on commit 2cd0db4

Please sign in to comment.