CmHandle delete is failing with InternalServerError: Null key is not allowed - add... 38/137138/2
authorleventecsanyi <levente.csanyi@est.tech>
Tue, 6 Feb 2024 12:56:13 +0000 (13:56 +0100)
committerleventecsanyi <levente.csanyi@est.tech>
Wed, 7 Feb 2024 09:36:11 +0000 (10:36 +0100)
Issue-ID: CPS-2064
Change-Id: If765c25cae8d69796fff219fc39ab27455bfd957
Signed-off-by: leventecsanyi <levente.csanyi@est.tech>
cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/utils/CmHandleIdMapperSpec.groovy

index 0a2962e..55ccdf3 100644 (file)
@@ -78,6 +78,15 @@ class CmHandleIdMapperSpec extends Specification {
             assert objectUnderTest.cmHandleIdToAlternateId('my cmhandle id') == null
     }
 
+    def 'Attempt to remove a non-existing entry from the cache.'() {
+        when: 'removing an entry that is not cached'
+            objectUnderTest.removeMapping('non-cached cmhandle id')
+        then: 'deleting from the cmhandle cache returns null'
+            assert alternateIdPerCmHandle.remove('non-cached cmhandle id') == null
+        and: 'removal from the alternate id cache is skipped'
+            0 * cmHandlePerAlternateId.remove(_)
+    }
+
     def 'Cannot update existing alternate id.'() {
         given: 'attempt to update an existing alternate id'
             objectUnderTest.addMapping('my cmhandle id', 'other id')