diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index 407e7b9..a7b736c 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -5,5 +5,6 @@ requires transitive io.avaje.applog; requires static org.yaml.snakeyaml; + uses io.avaje.config.EventLog; uses io.avaje.config.ConfigurationSource; } diff --git a/src/test/java/io/avaje/config/CoreConfigurationTest.java b/src/test/java/io/avaje/config/CoreConfigurationTest.java index 4c73382..9e20ffa 100644 --- a/src/test/java/io/avaje/config/CoreConfigurationTest.java +++ b/src/test/java/io/avaje/config/CoreConfigurationTest.java @@ -106,7 +106,7 @@ void forPath_nested() { @Test void test_toString() { assertThat(data.toString()).isNotEmpty(); - data.setWatcher(new FileWatch( Mockito.mock(CoreConfiguration.class), Collections.emptyList(), null)); + data.setWatcher(new FileWatch( new CoreConfiguration(new DefaultEventLog(), new Properties()) , Collections.emptyList(), null)); data.loadIntoSystemProperties(); } diff --git a/src/test/java/io/avaje/config/InitialLoaderTest.java b/src/test/java/io/avaje/config/InitialLoaderTest.java index a2cf138..52b837e 100644 --- a/src/test/java/io/avaje/config/InitialLoaderTest.java +++ b/src/test/java/io/avaje/config/InitialLoaderTest.java @@ -109,15 +109,19 @@ void loadViaCommandLine_localFile() { @Test void load_withSuppressTestResource() { //application-test.yaml is loaded when suppressTestResource is not set to true - System.setProperty("suppressTestResource", ""); - InitialLoader loader = new InitialLoader(new DefaultEventLog()); - Properties properties = loader.load(); - assertThat(properties.getProperty("myapp.activateFoo")).isEqualTo("true"); - - //application-test.yaml is not loaded when suppressTestResource is set to true - System.setProperty("suppressTestResource", "true"); - InitialLoader loaderWithSuppressTestResource = new InitialLoader(new DefaultEventLog()); - Properties propertiesWithoutTestResource = loaderWithSuppressTestResource.load(); - assertThat(propertiesWithoutTestResource.getProperty("myapp.activateFoo")).isNull(); + try { + System.setProperty("suppressTestResource", ""); + InitialLoader loader = new InitialLoader(new DefaultEventLog()); + Properties properties = loader.load(); + assertThat(properties.getProperty("myapp.activateFoo")).isEqualTo("true"); + + //application-test.yaml is not loaded when suppressTestResource is set to true + System.setProperty("suppressTestResource", "true"); + InitialLoader loaderWithSuppressTestResource = new InitialLoader(new DefaultEventLog()); + Properties propertiesWithoutTestResource = loaderWithSuppressTestResource.load(); + assertThat(propertiesWithoutTestResource.getProperty("myapp.activateFoo")).isNull(); + } finally { + System.clearProperty("suppressTestResource"); + } } }