aboutsummaryrefslogtreecommitdiffstats
path: root/sources/hv-collector-test-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/tests/utils/assertions.kt
diff options
context:
space:
mode:
Diffstat (limited to 'sources/hv-collector-test-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/tests/utils/assertions.kt')
-rw-r--r--sources/hv-collector-test-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/tests/utils/assertions.kt8
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