mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-01-04 04:07:16 +02:00
feat (remove key from commonPipelineEnvironment) (#4074)
* Add method to remove values from commonPipelineEnvironment * Add test to validate remove value from map Co-authored-by: i850487 <thilaknath.ashok.kumar@sap.com>
This commit is contained in:
parent
761dc75e82
commit
e25b2a126f
@ -51,6 +51,14 @@ class CommonPipelineEnvironmentTest extends BasePiperTest {
|
||||
assertThat(nullScript.commonPipelineEnvironment.getValue('myList').key2, is('val2'))
|
||||
}
|
||||
|
||||
@Test
|
||||
void testKeyRemoveFromMap() {
|
||||
nullScript.commonPipelineEnvironment.setValue('myList', [])
|
||||
nullScript.commonPipelineEnvironment.getValue('myList').add('item1')
|
||||
nullScript.commonPipelineEnvironment.removeValue('myList')
|
||||
assertThat(nullScript.commonPipelineEnvironment.getValue('myList'), is(null))
|
||||
}
|
||||
|
||||
@Test
|
||||
void testContainereMap() {
|
||||
nullScript.commonPipelineEnvironment.setContainerProperty('image', 'myImage')
|
||||
|
@ -66,6 +66,10 @@ class commonPipelineEnvironment implements Serializable {
|
||||
valueMap[property] = value
|
||||
}
|
||||
|
||||
void removeValue(String property) {
|
||||
valueMap.remove(property)
|
||||
}
|
||||
|
||||
def getValue(String property) {
|
||||
return valueMap.get(property)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user