- def 'Combine two query results where #scenario.'() {
- when: 'two query results in the form of a map of NcmpServiceCmHandles are combined into a single query result'
- def result = objectUnderTest.combineCmHandleQueries(firstQuery, secondQuery)
- then: 'the returned result is the same as the expected result'
- result == expectedResult
- where:
- scenario | firstQuery | secondQuery || expectedResult
- 'two queries with unique and non unique entries exist' | ['PNFDemo': pnfDemoCmHandle, 'PNFDemo2': pnfDemo2CmHandle] | ['PNFDemo': pnfDemoCmHandle, 'PNFDemo3': pnfDemo3CmHandle] || ['PNFDemo': pnfDemoCmHandle]
- 'the first query contains entries and second query is empty' | ['PNFDemo': pnfDemoCmHandle, 'PNFDemo2': pnfDemo2CmHandle] | [:] || [:]
- 'the second query contains entries and first query is empty' | [:] | ['PNFDemo': pnfDemoCmHandle, 'PNFDemo3': pnfDemo3CmHandle] || [:]
- 'the first query contains entries and second query is null' | ['PNFDemo': pnfDemoCmHandle, 'PNFDemo2': pnfDemo2CmHandle] | null || ['PNFDemo': pnfDemoCmHandle, 'PNFDemo2': pnfDemo2CmHandle]
- 'the second query contains entries and first query is null' | null | ['PNFDemo': pnfDemoCmHandle, 'PNFDemo3': pnfDemo3CmHandle] || ['PNFDemo': pnfDemoCmHandle, 'PNFDemo3': pnfDemo3CmHandle]
- 'both queries are empty' | [:] | [:] || [:]
- 'both queries are null' | null | null || null
+ def 'Query CmHandles using empty private properties query pair.'() {
+ when: 'a query on CmHandle private properties is executed using an empty map'
+ def result = objectUnderTest.queryCmHandleAdditionalProperties([:])
+ then: 'no cm handles are returned'
+ result.size() == 0
+ }
+
+ def 'Query CmHandles by a private field\'s value.'() {
+ given: 'a data node exists with a certain additional-property'
+ cpsDataPersistenceService.queryDataNodes(_, _, dataNodeWithPrivateField, _) >> [pnfDemo5]
+ when: 'a query on CmHandle private properties is executed using a map'
+ def result = objectUnderTest.queryCmHandleAdditionalProperties(['Contact3': 'newemailforstore3@bookstore.com'])
+ then: 'one cm handle is returned'
+ result.size() == 1