diff options
author | Piotr Jaszczyk <piotr.jaszczyk@nokia.com> | 2019-02-18 13:16:37 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-02-18 13:16:37 +0000 |
commit | dc47bd1847a46fe0ad0ca6c10a4d61f829f4c0c6 (patch) | |
tree | 1b9eff9ac4b334d5d8b9eedda2487711d363c060 /sources/hv-collector-test-utils | |
parent | 7b4e5e94ce9533fb9bcb53a764eeb63e7a0bef00 (diff) | |
parent | df17f466577b97a12fac39b64b5d113f32b82f2e (diff) |
Merge "Generate VesEvents in hv-ves/message-generator"
Diffstat (limited to 'sources/hv-collector-test-utils')
-rw-r--r-- | sources/hv-collector-test-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/tests/utils/assertions.kt | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sources/hv-collector-test-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/tests/utils/assertions.kt b/sources/hv-collector-test-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/tests/utils/assertions.kt index 6ca28a56..deb4132f 100644 --- a/sources/hv-collector-test-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/tests/utils/assertions.kt +++ b/sources/hv-collector-test-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/tests/utils/assertions.kt @@ -20,8 +20,11 @@ package org.onap.dcae.collectors.veshv.tests.utils import arrow.core.Either +import org.assertj.core.api.Assertions +import org.assertj.core.api.ObjectAssert import org.onap.dcae.collectors.veshv.utils.logging.Logger import java.time.Duration +import kotlin.test.fail /** * @author Piotr Jaszczyk <piotr.jaszczyk@nokia.com> @@ -34,7 +37,6 @@ object Assertions : org.assertj.core.api.Assertions() { fun <A, B> assertThat(actual: Either<A, B>) = EitherAssert(actual) } - fun waitUntilSucceeds(action: () -> Unit) = waitUntilSucceeds(50, Duration.ofMillis(10), action) fun waitUntilSucceeds(retries: Int, sleepTime: Duration, action: () -> Unit) { @@ -53,3 +55,7 @@ fun waitUntilSucceeds(retries: Int, sleepTime: Duration, action: () -> Unit) { } } } + +fun <A, B> Either<A, B>.assertFailedWithError(assertj: (ObjectAssert<A>) -> Unit) { + fold({ assertj(Assertions.assertThat(it)) }, { fail("Error expected") }) +}
\ No newline at end of file |