8000 Scala · awaitility/awaitility Wiki · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
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>

Example

Clone this wiki locally
0