My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
Scala  
Scala API for Awaitility
Updated Nov 8, 2010 by johan.ha...@gmail.com

Scala API

We have also added 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>com.jayway.awaitility</groupId>
    <artifactId>awaitility-scala</artifactId>
    <version>${awaitility.version}</version>
</dependency>

Example

  1. Scala example

Sign in to add a comment
Powered by Google Project Hosting