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

The 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