Fix `YamlConfiruration#getKeys("")` not returning root node keys
This commit is contained in:
parent
2683bc12c0
commit
885cc9a87e
|
@ -96,6 +96,10 @@ public class YamlConfiguration implements IConfiguration, HeaderCommentable, Nod
|
|||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
if (key.equals("")) {
|
||||
return Collections.unmodifiableSet(this.values.keySet());
|
||||
}
|
||||
|
||||
Map<String, ?> innerMap = null;
|
||||
|
||||
try {
|
||||
|
@ -260,8 +264,8 @@ public class YamlConfiguration implements IConfiguration, HeaderCommentable, Nod
|
|||
@Override
|
||||
public String toString() {
|
||||
return "YamlConfiguration{" +
|
||||
"values=" + values +
|
||||
", headerComment=" + headerComment +
|
||||
"values=" + this.values +
|
||||
", headerComment=" + this.headerComment +
|
||||
'}';
|
||||
}
|
||||
|
||||
|
|
|
@ -274,7 +274,7 @@ class YamlConfigurationTest {
|
|||
final YamlConfiguration cfg = new YamlConfiguration();
|
||||
cfg.load(new StringReader(inputYaml));
|
||||
|
||||
assertTrue(cfg.getKeys("").isEmpty());
|
||||
assertEquals(2, cfg.getKeys("").size());
|
||||
assertTrue(cfg.getKeys(null).isEmpty());
|
||||
|
||||
assertTrue(cfg.getKeys("primitives.map.key.non-existing-subkey").isEmpty());
|
||||
|
|
Loading…
Reference in New Issue