2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2024 Nordix Foundation
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.cps.ncmp.impl.cmnotificationsubscription
24 import org.onap.cps.ncmp.impl.cmnotificationsubscription.dmi.DmiInEventMapper
25 import org.onap.cps.ncmp.impl.cmnotificationsubscription.ncmp.NcmpOutEventMapper
26 import spock.lang.Specification
28 class MappersFacadeSpec extends Specification{
30 def mockCmNotificationDmiInEventMapper = Mock(DmiInEventMapper)
31 def mockCmNotificationNcmpOutEventMapper = Mock(NcmpOutEventMapper)
33 def objectUnderTest = new MappersFacade(mockCmNotificationDmiInEventMapper,
34 mockCmNotificationNcmpOutEventMapper)
36 def 'Get cm notification subscription DMI in event'() {
37 given: 'a list of predicates'
38 def testListOfPredicates = []
39 when: 'method to create a cm notification subscription dmi in event is called with predicates'
40 objectUnderTest.toDmiInEvent(testListOfPredicates)
41 then: 'the parameters is delegated to the correct dmi in event mapper method'
42 1 * mockCmNotificationDmiInEventMapper.toDmiInEvent(testListOfPredicates)
45 def 'Get cm notification subscription ncmp out event'() {
46 given: 'a subscription details map'
47 def testSubscriptionDetailsMap = [:]
48 when: 'method to create cm notification subscription ncmp out event is called with the following parameters'
49 objectUnderTest.toNcmpOutEvent("test-id", testSubscriptionDetailsMap)
50 then: 'the parameters is delegated to the correct ncmp out event mapper method'
51 1 * mockCmNotificationNcmpOutEventMapper.toNcmpOutEvent("test-id",
52 testSubscriptionDetailsMap)
55 def 'Get cm notification subscription ncmp out event for a rejected request'() {
56 given: 'a list of target filters'
57 def testRejectedTargetFilters = []
58 when: 'method to create cm notification subscription ncmp out event is called with the following parameters'
59 objectUnderTest.toNcmpOutEventForRejectedRequest(
60 "test-id", testRejectedTargetFilters)
61 then: 'the parameters is delegated to the correct ncmp out event mapper method'
62 1 * mockCmNotificationNcmpOutEventMapper.toNcmpOutEventForRejectedRequest(
63 "test-id", testRejectedTargetFilters)