eventually-matchers

Simple asynchronous hamcrest matchers

Лицензия

Лицензия

MIT
Категории

Категории

Ant Компиляция и сборка
Группа

Группа

com.github.grantwest.eventually
Идентификатор

Идентификатор

hamcrest-eventually-matchers
Последняя версия

Последняя версия

0.0.3
Дата

Дата

Тип

Тип

jar
Описание

Описание

eventually-matchers
Simple asynchronous hamcrest matchers
Ссылка на сайт

Ссылка на сайт

https://github.com/grantwest/eventually-matchers
Система контроля версий

Система контроля версий

https://github.com/grantwest/eventually-matchers

Скачать hamcrest-eventually-matchers

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.github.grantwest.eventually/hamcrest-eventually-matchers/ -->
<dependency>
    <groupId>com.github.grantwest.eventually</groupId>
    <artifactId>hamcrest-eventually-matchers</artifactId>
    <version>0.0.3</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.grantwest.eventually/hamcrest-eventually-matchers/
implementation 'com.github.grantwest.eventually:hamcrest-eventually-matchers:0.0.3'
// https://jarcasting.com/artifacts/com.github.grantwest.eventually/hamcrest-eventually-matchers/
implementation ("com.github.grantwest.eventually:hamcrest-eventually-matchers:0.0.3")
'com.github.grantwest.eventually:hamcrest-eventually-matchers:jar:0.0.3'
<dependency org="com.github.grantwest.eventually" name="hamcrest-eventually-matchers" rev="0.0.3">
  <artifact name="hamcrest-eventually-matchers" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.grantwest.eventually', module='hamcrest-eventually-matchers', version='0.0.3')
)
libraryDependencies += "com.github.grantwest.eventually" % "hamcrest-eventually-matchers" % "0.0.3"
[com.github.grantwest.eventually/hamcrest-eventually-matchers "0.0.3"]

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
org.hamcrest : java-hamcrest jar 2.0.0.0

test (1)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12

Модули Проекта

Данный проект не имеет модулей.

Easy asynchronous asserts with JUnit & Hamcrest

Usage

These matchers are available via Maven Central. Add this to your pom.xml:

<dependency>
  <groupId>com.github.grantwest.eventually</groupId>
   <artifactId>hamcrest-eventually-matchers</artifactId>
   <version>0.0.3</version>
   <scope>test</scope>
</dependency>

Lets say another thread is supposed to add an element to a collection:

Collection<String> listOfNames; //Collection other thread is adding names to
assertThat(listOfNames, eventually(hasItem("Grant")));

To test a value we use a lambda:

boolean b = false; //Some other thread will set b to true
assertThat(() -> b, eventuallyEval(is(true)));

The eventually matchers have a default timeout of 5 seconds. The timeout can be overridden like this:

assertThat(() -> b, eventuallyEval(is(true), Duration.ofSeconds(30)));

To assert that someFunction() eventually returns true:

assertThat(() -> someFunction(), eventuallyEval(is(true)));

The matchers are known to work with:

  • junit 4.12
  • java-hamcrest 2.0.0.0

Версии библиотеки

Версия
0.0.3
0.0.1