add tests

This commit is contained in:
Christopher Fenner
2018-03-14 15:44:04 +01:00
parent ada195fc9f
commit cb9b8e6360
@@ -4,6 +4,8 @@ import groovy.test.GroovyAssert
import org.junit.Assert
import org.junit.Test
import static org.hamcrest.Matchers.*
class ConfigurationHelperTest {
private static getConfiguration() {
@@ -42,4 +44,29 @@ class ConfigurationHelperTest {
GroovyAssert.shouldFail { configuration.getMandatoryProperty('something') }
}
@Test
void testConfigurationLoaderWithDefaults() {
Map config = new ConfigurationHelper([property1: "27"]).use()
// asserts
Assert.assertThat(config, hasEntry('property1', true))
}
@Test
void testConfigurationLoaderWithCustomSettings() {
Map config = new ConfigurationHelper([property1: "27"])
.mixin([property1: "41"]], ['property2'])
.use()
// asserts
Assert.assertThat(config, hasEntry('property1', false))
}
@Test
void testConfigurationLoaderWithFilteredCustomSettings() {
Map config = new ConfigurationHelper([property1: "27"])
.mixin([property1: "41"]], ['property2'])
.use()
// asserts
Assert.assertThat(config, hasEntry('property1', "27"))
}
}