Improve test coverage trustlevel manager 41/139641/1
authorToineSiebelink <toine.siebelink@est.tech>
Tue, 3 Dec 2024 18:29:25 +0000 (18:29 +0000)
committerToineSiebelink <toine.siebelink@est.tech>
Tue, 3 Dec 2024 18:29:25 +0000 (18:29 +0000)
Issue-ID: CPS-475
Change-Id: I572227b4f6c61bd2286d8cb3fb85c3dc21142a47
Signed-off-by: ToineSiebelink <toine.siebelink@est.tech>
cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/trustlevel/TrustLevelManagerSpec.groovy

index 4f41f2c..bf79fe3 100644 (file)
@@ -209,13 +209,16 @@ class TrustLevelManagerSpec extends Specification {
             assert ncmpServiceCmHandle.currentTrustLevel == TrustLevel.NONE
     }
 
-    def 'CmHandle trust level removed'() {
-        given: 'a cm handle'
+    def 'Removing cm Handle ids from trust level cache.'() {
+        given: 'a cm handle id with trustlevel in the cache'
             trustLevelPerCmHandleId.put('ch-1', TrustLevel.COMPLETE)
-        when: 'the remove is handled'
-            objectUnderTest.removeCmHandles(['ch-1'])
-        then: 'cm handle removed from the cache'
-            assert trustLevelPerCmHandleId.get('ch-1') == null
+        when: 'remove existing and non-existing cm handle ids'
+            objectUnderTest.removeCmHandles(['non-existing-id','ch-1'])
+        then: 'both cm handle ids are not included in the cache'
+            assert !trustLevelPerCmHandleId.contains('non-existing-id')
+            assert !trustLevelPerCmHandleId.contains('ch-1')
+        and: 'removing the non-existing id did not cause an exception'
+            noExceptionThrown()
     }
 
 }