All Downloads are FREE. Search and download functionalities are using the official Maven repository.

pl.allegro.tech.servicemesh.envoycontrol.assertions.AwaitAssertions.kt Maven / Gradle / Ivy

There is a newer version: 0.22.1
Show newest version
package pl.allegro.tech.servicemesh.envoycontrol.assertions

import org.assertj.core.api.Assertions
import org.awaitility.Awaitility
import java.time.Duration

fun  untilAsserted(
    poll: Duration = Duration.ofMillis(500),
    wait: Duration = Duration.ofSeconds(90),
    fn: () -> (T)
): T {
    var lastResult: T? = null
    Awaitility.await().atMost(wait)
        .pollInterval(poll)
        .untilAsserted { lastResult = fn() }
    Assertions.assertThat(lastResult).isNotNull
    return lastResult!!
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy