diff --git a/src/test/java/com/tchristofferson/configupdater/ConfigUpdaterTest.java b/src/test/java/com/tchristofferson/configupdater/ConfigUpdaterTest.java index 3bb5d91..7ce099c 100644 --- a/src/test/java/com/tchristofferson/configupdater/ConfigUpdaterTest.java +++ b/src/test/java/com/tchristofferson/configupdater/ConfigUpdaterTest.java @@ -107,6 +107,25 @@ public void testIgnoredEmptySectionIsValidAfterUpdate() throws IOException { assertTrue(section.getKeys(false).isEmpty()); } + @Test + public void testDefaultIgnoredEmptySectionWithKeysInConfigIsSameAfterUpdate() throws IOException { + File toUpdate = new File(FILE_NAME); + FileConfiguration config = YamlConfiguration.loadConfiguration(toUpdate); + config.set("ignored-empty.test", 1); + config.save(toUpdate); + + ConfigUpdater.update(plugin, FILE_NAME, toUpdate, "ignored-empty"); + config = YamlConfiguration.loadConfiguration(toUpdate); + + Object obj = config.get("ignored-empty", null); + assertNotNull(obj); + assertTrue(obj instanceof ConfigurationSection); + + ConfigurationSection section = (ConfigurationSection) obj; + assertFalse(section.getKeys(false).isEmpty()); + assertEquals(section.get("test", null), 1); + } + @Test public void testIgnoredSectionKeysAreStillValidAfterUpdate() throws IOException { File toUpdate = new File(FILE_NAME);