From 33619dca1c18bee7d055743def5abcf69f202670 Mon Sep 17 00:00:00 2001 From: Ondrej Zizka Date: Mon, 26 Aug 2024 08:43:57 +0200 Subject: [PATCH] Mate test more readable --- src/test/java/ch/zizka/yaml/merger/YamlMergerTest.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/test/java/ch/zizka/yaml/merger/YamlMergerTest.kt b/src/test/java/ch/zizka/yaml/merger/YamlMergerTest.kt index bd38726..9a25cab 100644 --- a/src/test/java/ch/zizka/yaml/merger/YamlMergerTest.kt +++ b/src/test/java/ch/zizka/yaml/merger/YamlMergerTest.kt @@ -42,6 +42,7 @@ class YamlMergerTest { @Test fun testMergeFileIntoSelf() { val merged = merger.mergeYamlFiles(arrayOf(YAML_1, YAML_1)) + val dbconfig = merged["database"] as Map? Assertions.assertEquals(dbconfig!!["user"], "some-user", "wrong user") Assertions.assertEquals(dbconfig["url"], "jdbc:mysql://localhost:3306/some-db", "wrong db url") @@ -50,6 +51,7 @@ class YamlMergerTest { @Test fun testNullValue() { val merged = merger.mergeYamlFiles(arrayOf(YAML_NULL)) + Assertions.assertNotNull(merged["prop1"]) Assertions.assertNull(merged["prop2"]) } @@ -58,6 +60,7 @@ class YamlMergerTest { fun testSubstitutionValueWithColon() { val variables = Collections.singletonMap("ENV_VAR", "localhost") val merged = YamlMerger().setVariablesToReplace(variables).mergeYamlFiles(arrayOf(YAML_COLON)) + val hash = merged["memcache"] as Map? Assertions.assertEquals(hash!!["one_key"], "value1") Assertions.assertEquals(hash["another_key"], "localhost:22133") @@ -67,6 +70,7 @@ class YamlMergerTest { @Test fun testMerge2Lists() { val merged = merger.mergeYamlFiles(arrayOf(MERGE_YAML_1, MERGE_YAML_2)) + val hash1 = merged["hashlevel1"] as Map? val list1 = hash1!!["listlevel2"] as List? Assertions.assertEquals(list1!!.size, 2, "NotEnoughEntries")