1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-14 11:03:09 +02:00
sap-jenkins-library/test/groovy/com/sap/piper/ConfigurationMergerTest.groovy
Daniel Kurzynski 22ee06dc17 Enable configuration via yaml file + mavenExecute as example (#18)
* Enable configuration via yaml file
* Add documentation 
* Add tests
2017-12-06 12:03:06 +01:00

30 lines
979 B
Groovy

package com.sap.piper
import org.junit.Assert
import org.junit.Test
class ConfigurationMergerTest {
@Test
void testMerge(){
Map defaults = [dockerImage: 'mvn']
Map parameters = [goals: 'install', flags: '']
List parameterKeys = ['flags']
Map configuration = [flags: '-B']
List configurationKeys = ['flags']
Map merged = ConfigurationMerger.merge(parameters, parameterKeys, configuration, configurationKeys, defaults)
Assert.assertEquals('mvn', merged.dockerImage)
Assert.assertNull(merged.goals)
Assert.assertEquals('', merged.flags)
}
@Test
void testMergeParameterWithDefault(){
Map defaults = [nonErpDestinations: []]
Map parameters = [nonErpDestinations: null]
List parameterKeys = ['nonErpDestinations']
Map merged = ConfigurationMerger.merge(parameters, parameterKeys, defaults)
Assert.assertEquals([], merged.nonErpDestinations)
}
}