Skip to content

Commit

Permalink
Added test
Browse files Browse the repository at this point in the history
  • Loading branch information
tchristofferson committed Jul 4, 2023
1 parent 03127de commit 58c9b39
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 58c9b39

Please sign in to comment.