From 67689405071acdad2b26d5112b3662605e474ce9 Mon Sep 17 00:00:00 2001 From: Piotr Jaszczyk Date: Thu, 14 Jun 2018 09:48:46 +0200 Subject: Various improvements * Kotlin upgrade * Monad usage on APIs * Idle timeout * Simulator enhancements Closes ONAP-390 Change-Id: I3c00fcfe38c722caf661ddaad428cf089eeefcaa Signed-off-by: Piotr Jaszczyk Issue-ID: DCAEGEN2-601 --- .../org/onap/dcae/collectors/veshv/impl/RouterTest.kt | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'hv-collector-core/src/test') diff --git a/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/impl/RouterTest.kt b/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/impl/RouterTest.kt index c852f5f4..599a9d40 100644 --- a/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/impl/RouterTest.kt +++ b/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/impl/RouterTest.kt @@ -19,12 +19,15 @@ */ package org.onap.dcae.collectors.veshv.impl +import arrow.core.None +import arrow.core.Some import org.assertj.core.api.Assertions.assertThat import org.jetbrains.spek.api.Spek import org.jetbrains.spek.api.dsl.given import org.jetbrains.spek.api.dsl.it import org.jetbrains.spek.api.dsl.on import org.onap.dcae.collectors.veshv.domain.ByteData +import org.onap.dcae.collectors.veshv.model.RoutedMessage import org.onap.dcae.collectors.veshv.model.VesMessage import org.onap.dcae.collectors.veshv.model.routing import org.onap.ves.VesEventV5.VesEvent.CommonEventHeader @@ -61,15 +64,15 @@ object RouterTest : Spek({ } it("should be routed to proper partition") { - assertThat(result?.partition).isEqualTo(2) + assertThat(result.map(RoutedMessage::partition)).isEqualTo(Some(2)) } it("should be routed to proper topic") { - assertThat(result?.topic).isEqualTo("ves_rtpm") + assertThat(result.map(RoutedMessage::topic)).isEqualTo(Some("ves_rtpm")) } it("should be routed with a given message") { - assertThat(result?.message).isSameAs(message) + assertThat(result.map(RoutedMessage::message)).isEqualTo(Some(message)) } } @@ -82,15 +85,15 @@ object RouterTest : Spek({ } it("should be routed to proper partition") { - assertThat(result?.partition).isEqualTo(0) + assertThat(result.map(RoutedMessage::partition)).isEqualTo(Some(0)) } it("should be routed to proper topic") { - assertThat(result?.topic).isEqualTo("ves_trace") + assertThat(result.map(RoutedMessage::topic)).isEqualTo(Some("ves_trace")) } it("should be routed with a given message") { - assertThat(result?.message).isSameAs(message) + assertThat(result.map(RoutedMessage::message)).isEqualTo(Some(message)) } } @@ -99,7 +102,7 @@ object RouterTest : Spek({ val result = cut.findDestination(message) it("should not have route available") { - assertThat(result).isNull() + assertThat(result).isEqualTo(None) } } } -- cgit 1.2.3-korg