summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorleventecsanyi <levente.csanyi@est.tech>2024-02-06 13:56:13 +0100
committerleventecsanyi <levente.csanyi@est.tech>2024-02-07 10:36:11 +0100
commitedf5d59148bc2e43258a1e7c596b02bc46f0172f (patch)
tree1553e88183a4a1e223e2a0a5e0614776894061c3
parent627e9cb5f6bf7ea66bba15a376bbbfc134e588d9 (diff)
CmHandle delete is failing with InternalServerError: Null key is not allowed - add missing unit test
Issue-ID: CPS-2064 Change-Id: If765c25cae8d69796fff219fc39ab27455bfd957 Signed-off-by: leventecsanyi <levente.csanyi@est.tech>
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/utils/CmHandleIdMapperSpec.groovy9
1 files changed, 9 insertions, 0 deletions
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/utils/CmHandleIdMapperSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/utils/CmHandleIdMapperSpec.groovy
index 0a2962e98f..55ccdf3be5 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/utils/CmHandleIdMapperSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/utils/CmHandleIdMapperSpec.groovy
@@ -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')