From a40ef852a33e1fb335b6bf8b36515a0ef7546f2c Mon Sep 17 00:00:00 2001 From: Filip Krzywka Date: Wed, 5 Sep 2018 10:37:51 +0200 Subject: Handle non-existing Collector instance Change-Id: I0b6cd5023b2bca0f0bee6958c107fc560fc95b52 Issue-ID: DCAEGEN2-751 Signed-off-by: Filip Krzywka --- .../test/kotlin/org/onap/dcae/collectors/veshv/tests/component/Sut.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'hv-collector-ct/src') diff --git a/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/component/Sut.kt b/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/component/Sut.kt index e9b70578..942e6edf 100644 --- a/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/component/Sut.kt +++ b/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/component/Sut.kt @@ -19,6 +19,7 @@ */ package org.onap.dcae.collectors.veshv.tests.component +import arrow.core.getOrElse import io.netty.buffer.ByteBuf import io.netty.buffer.ByteBufAllocator import io.netty.buffer.UnpooledByteBufAllocator @@ -48,7 +49,7 @@ class Sut(sink: Sink = StoringSink()) { private val collectorProvider = collectorFactory.createVesHvCollectorProvider() val collector: Collector - get() = collectorProvider() + get() = collectorProvider().getOrElse{ throw IllegalStateException("Collector not available.") } } fun Sut.handleConnection(sink: StoringSink, vararg packets: ByteBuf): List { -- cgit 1.2.3-korg