Added/updated tests
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package de.rwu.easydrop.util;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
@@ -34,7 +35,9 @@ class ConfigImplTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testGetProperty_ConfigNotLoaded() {
|
||||
void testGetProperty_ConfigNotLoaded() throws Exception {
|
||||
config.reset();
|
||||
|
||||
NoSuchElementException exception = assertThrows(NoSuchElementException.class, () -> {
|
||||
config.getProperty(TESTDATA_KEY);
|
||||
});
|
||||
@@ -92,4 +95,19 @@ class ConfigImplTest {
|
||||
|
||||
assertEquals("Couldn't load required config file", exception.getMessage());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testReset() throws ConfigurationException {
|
||||
config.setConfigLocation("src/test/resources/testdata.properties");
|
||||
config.loadConfig();
|
||||
|
||||
assertNotNull(config.getProperty(TESTDATA_KEY));
|
||||
config.reset();
|
||||
|
||||
NoSuchElementException exception = assertThrows(NoSuchElementException.class, () -> {
|
||||
config.getProperty(TESTDATA_KEY);
|
||||
});
|
||||
|
||||
assertEquals("Config has not been loaded", exception.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user