Skip to content

Commit

Permalink
Refactor rename internal method loadFileWithExtensionCheck() -> loadW…
Browse files Browse the repository at this point in the history
…ithExtensionCheck()
  • Loading branch information
rbygrave committed Nov 4, 2022
1 parent f5bffc4 commit 8b58626
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/main/java/io/avaje/config/InitialLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ private void loadViaIndirection() {

private void loadViaPaths(String paths) {
for (String path : splitPaths(paths)) {
loadFileWithExtensionCheck(loadContext.eval(path));
loadWithExtensionCheck(loadContext.eval(path));
}
}

Expand Down Expand Up @@ -230,14 +230,14 @@ private void loadViaSystemProperty() {
if (fileName == null) {
fileName = System.getProperty("props.file");
if (fileName != null) {
if (!loadFileWithExtensionCheck(fileName)) {
if (!loadWithExtensionCheck(fileName)) {
Config.log.log(Level.WARNING, "Unable to find file {0} to load properties", fileName);
}
}
}
}

boolean loadFileWithExtensionCheck(String fileName) {
boolean loadWithExtensionCheck(String fileName) {
if (fileName.endsWith("yaml") || fileName.endsWith("yml")) {
return loadYaml(fileName, RESOURCE) || loadYaml(fileName, FILE);
} else if (fileName.endsWith("properties")) {
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/io/avaje/config/InitialLoaderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ void load() {
@Test
void loadWithExtensionCheck() {
InitialLoader loader = new InitialLoader();
loader.loadFileWithExtensionCheck("test-dummy.properties");
loader.loadFileWithExtensionCheck("test-dummy.yml");
loader.loadFileWithExtensionCheck("test-dummy2.yaml");
loader.loadWithExtensionCheck("test-dummy.properties");
loader.loadWithExtensionCheck("test-dummy.yml");
loader.loadWithExtensionCheck("test-dummy2.yaml");

Properties properties = loader.eval();
assertThat(properties.getProperty("dummy.yaml.bar")).isEqualTo("baz");
Expand Down

0 comments on commit 8b58626

Please sign in to comment.