aboutsummaryrefslogtreecommitdiffstats
path: root/hv-collector-main/src/test
diff options
context:
space:
mode:
authorPiotr Jaszczyk <piotr.jaszczyk@nokia.com>2018-07-04 13:16:21 +0200
committerPiotr Jaszczyk <piotr.jaszczyk@nokia.com>2018-08-02 12:01:26 +0200
commite31d59f63ebe5536d2d2d868703eb8896924b63d (patch)
tree0ed280beb287c59fbd7a3494684884f5738e377d /hv-collector-main/src/test
parente5ce5ac06cf1ce95a65f18ad05be9e8432be6d49 (diff)
Use IO monad when starting servers
Change-Id: I3e97161535fc721dda6109c4cb5f23a1db0afde3 Signed-off-by: Piotr Jaszczyk <piotr.jaszczyk@nokia.com> Issue-ID: DCAEGEN2-601
Diffstat (limited to 'hv-collector-main/src/test')
-rw-r--r--hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/ArgBasedServerConfigurationTest.kt13
1 files changed, 6 insertions, 7 deletions
diff --git a/hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/ArgBasedServerConfigurationTest.kt b/hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/ArgBasedServerConfigurationTest.kt
index a14801da..2c49cf98 100644
--- a/hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/ArgBasedServerConfigurationTest.kt
+++ b/hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/ArgBasedServerConfigurationTest.kt
@@ -21,6 +21,7 @@ package org.onap.dcae.collectors.veshv.main
import arrow.core.Failure
import arrow.core.Success
+import arrow.core.identity
import org.assertj.core.api.Assertions.assertThat
import org.jetbrains.spek.api.Spek
import org.jetbrains.spek.api.dsl.describe
@@ -49,13 +50,11 @@ object ArgBasedServerConfigurationTest : Spek({
cut = ArgBasedServerConfiguration()
}
- fun parse(vararg cmdLine: String): ServerConfiguration {
- val result = cut.parse(cmdLine)
- return when (result) {
- is Success -> result.value
- is Failure -> throw AssertionError("Parsing result should be present")
- }
- }
+ fun parse(vararg cmdLine: String): ServerConfiguration =
+ cut.parse(cmdLine).fold(
+ {throw AssertionError("Parsing result should be present")},
+ ::identity
+ )
describe("parsing arguments") {
given("all parameters are present in the long form") {