mirror of
https://github.com/SAP/jenkins-library.git
synced 2026-06-19 22:58:55 +02:00
add tests
This commit is contained in:
@@ -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"))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user