Skip to content

Commit

Permalink
Clarify test.
Browse files Browse the repository at this point in the history
  • Loading branch information
charleskorn committed Sep 1, 2019
1 parent b0bdbd6 commit 65c9f1c
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/test/kotlin/com/charleskorn/kaml/YamlReadingTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1072,22 +1072,18 @@ object YamlReadingTest : Spek({
}
}

context("given an object where the first property is nullable") {
context("given a nullable object") {
val input = """
mariaDb:
host: "db.test.com"
host: "db.test.com"
""".trimIndent()

@Serializable
data class MariaDb(val host: String)
data class Database(val host: String)

@Serializable
data class Server(val mariaDb: MariaDb? = null)

val result = Yaml.default.parse(Server.serializer(), input)
val result = Yaml.default.parse(makeNullable(Database.serializer()), input)

it("deserializes it to the expected object") {
assert(result).toBe(Server(MariaDb("db.test.com")))
assert(result).toBe(Database("db.test.com"))
}
}
}
Expand Down

0 comments on commit 65c9f1c

Please sign in to comment.