diff options
Diffstat (limited to 'cps-ncmp-service/src/test')
-rw-r--r-- | cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/event/lcm/LcmEventsServiceSpec.groovy | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/event/lcm/LcmEventsServiceSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/event/lcm/LcmEventsServiceSpec.groovy index 1eae357bb6..ef399e1c65 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/event/lcm/LcmEventsServiceSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/event/lcm/LcmEventsServiceSpec.groovy @@ -21,6 +21,7 @@ package org.onap.cps.ncmp.api.impl.event.lcm import org.onap.ncmp.cmhandle.event.lcm.LcmEvent +import org.springframework.kafka.KafkaException import spock.lang.Specification class LcmEventsServiceSpec extends Specification { @@ -45,4 +46,17 @@ class LcmEventsServiceSpec extends Specification { 'disabled' | false || 0 } + def 'Unable to send message'(){ + given: 'a cm handle id and Lcm Event and notification enabled' + def cmHandleId = 'test-cm-handle-id' + def lcmEvent = new LcmEvent(eventId: UUID.randomUUID().toString(), eventCorrelationId: cmHandleId) + objectUnderTest.notificationsEnabled = true + when: 'publisher set to throw an exception' + mockLcmEventsPublisher.publishEvent(*_) >> { throw new KafkaException('publishing failed')} + and: 'an event is publised' + objectUnderTest.publishLcmEvent(cmHandleId, lcmEvent) + then: 'the exception is just logged and not bubbled up' + noExceptionThrown() + } + } |