forked from sksamuel/hoplite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
32 additions
and
7 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
30 changes: 30 additions & 0 deletions
30
hoplite-yaml/src/test/kotlin/com/sksamuel/hoplite/yaml/DenormalizedLinkedHashMapKeysTest.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,30 @@ | ||
package com.sksamuel.hoplite.yaml | ||
|
||
import com.sksamuel.hoplite.ConfigLoaderBuilder | ||
import com.sksamuel.hoplite.addResourceOrFileSource | ||
import io.kotest.core.spec.style.FunSpec | ||
import io.kotest.matchers.shouldBe | ||
|
||
class DenormalizedLinkedHashMapKeysTest : FunSpec({ | ||
data class Foo( | ||
val xVal: String = "x" | ||
) | ||
|
||
data class LinkedHashMapContainer( | ||
val m: LinkedHashMap<String, Foo> = linkedMapOf() | ||
) | ||
|
||
test("should set denormalized map keys and decode a data class inside a linked has map map") { | ||
val config = ConfigLoaderBuilder.default() | ||
.addResourceOrFileSource("/test_data_class_in_map.yaml") | ||
.build() | ||
.loadConfigOrThrow<LinkedHashMapContainer>() | ||
|
||
config shouldBe LinkedHashMapContainer( | ||
m = linkedMapOf( | ||
"DC1" to Foo("10"), | ||
"DC2" to Foo("20"), | ||
) | ||
) | ||
} | ||
}) |