-
-
Notifications
You must be signed in to change notification settings - Fork 248
Scala
Johan Haleby edited this page Nov 16, 2018
·
5 revisions
Awaitility has a Scala API that allows you to write
await until { numberOfReceivedMessages() > 3 }
What you actually provide is a no argument function that returns a scala.Boolean
. To make this work you simply mixin the AwaitilitySupport
trait that is provided in the awaitility-scala module. Example:
class MyTest extends AwaitilitySupport {
@Test
def functionAsCondition() = {
await until { someCounter() > 3 }
await until { isDone() }
await until isDone
}
def isDone() : Boolean = {
// implementation goes here
}
def someCounter() : Int = {
// implementation goes here
}
// ...
}
Use the following Maven dependency:
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility-scala</artifactId>
<version>${awaitility.version}</version>
</dependency>