diff --git a/Core/src/main/java/com/songoda/core/configuration/yaml/YamlConfiguration.java b/Core/src/main/java/com/songoda/core/configuration/yaml/YamlConfiguration.java index 04711a4d..5bbeed17 100644 --- a/Core/src/main/java/com/songoda/core/configuration/yaml/YamlConfiguration.java +++ b/Core/src/main/java/com/songoda/core/configuration/yaml/YamlConfiguration.java @@ -21,6 +21,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Objects; @@ -37,7 +38,7 @@ public class YamlConfiguration implements IConfiguration, HeaderCommentable, Nod protected @Nullable Supplier headerComment; public YamlConfiguration() { - this(new HashMap<>(), new HashMap<>()); + this(new LinkedHashMap<>(), new LinkedHashMap<>()); } protected YamlConfiguration(@NotNull Map values, @NotNull Map> nodeComments) { diff --git a/Core/src/test/java/com/songoda/core/configuration/yaml/YamlConfigurationTest.java b/Core/src/test/java/com/songoda/core/configuration/yaml/YamlConfigurationTest.java index b667f3d7..a4071a09 100644 --- a/Core/src/test/java/com/songoda/core/configuration/yaml/YamlConfigurationTest.java +++ b/Core/src/test/java/com/songoda/core/configuration/yaml/YamlConfigurationTest.java @@ -47,7 +47,8 @@ class YamlConfigurationTest { " - 1\n" + " - 2\n" + " - 3\n"; - static final String expectedOutYaml = "primitives:\n" + + static final String expectedOutYaml = "foo: bar\n" + + "primitives:\n" + " int: " + Integer.MIN_VALUE + "\n" + " long: " + Long.MIN_VALUE + "\n" + " float: " + Float.MIN_VALUE + "\n" + @@ -69,8 +70,7 @@ class YamlConfigurationTest { " set:\n" + " - 1\n" + " - 2\n" + - " - 3\n" + - "foo: bar\n"; + " - 3\n"; @Test void testYamlParser() {