mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-01-20 05:19:40 +02:00
Merge branch 'master' into pr/httpsPushArtifactSetVersion
This commit is contained in:
commit
bd6cb9af3c
@ -20,6 +20,12 @@ class MapUtils implements Serializable {
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge two maps with the second one has precedence
|
||||
* @param base First map
|
||||
* @param overlay Second map, takes precedence
|
||||
* @return The merged map
|
||||
*/
|
||||
static Map merge(Map base, Map overlay) {
|
||||
|
||||
Map result = [:]
|
||||
|
@ -16,7 +16,7 @@ class MapUtilsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testMergeMapStraigtForward(){
|
||||
void testMergeMapStraightForward(){
|
||||
|
||||
Map a = [a: '1',
|
||||
c: [d: '1',
|
||||
@ -31,6 +31,20 @@ class MapUtilsTest {
|
||||
c: [d: 'x', e: '2']]
|
||||
}
|
||||
|
||||
@Test
|
||||
void testMergeMapWithConflict(){
|
||||
|
||||
Map a = [a: '1',
|
||||
b: [c: 1]],
|
||||
b = [a: '2',
|
||||
b: [c: 2]]
|
||||
|
||||
Map merged = MapUtils.merge(a, b)
|
||||
|
||||
assert merged == [a: '2',
|
||||
b: [c: 2]]
|
||||
}
|
||||
|
||||
@Test
|
||||
void testPruneNulls() {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user