eventualj

Eventual assertions, for Java. Making asynchronous assertions elegant.

Категории

Категории

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

Группа

no.antares
Идентификатор

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

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

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

0.5
Дата

Дата

Тип

Тип

jar
Описание

Описание

eventualj
Eventual assertions, for Java. Making asynchronous assertions elegant.
Ссылка на сайт

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

https://github.com/AntaTom/eventualj
Система контроля версий

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

https://github.com/AntaTom/eventualj

Скачать eventualj

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

<!-- https://jarcasting.com/artifacts/no.antares/eventualj/ -->
<dependency>
    <groupId>no.antares</groupId>
    <artifactId>eventualj</artifactId>
    <version>0.5</version>
</dependency>
// https://jarcasting.com/artifacts/no.antares/eventualj/
implementation 'no.antares:eventualj:0.5'
// https://jarcasting.com/artifacts/no.antares/eventualj/
implementation ("no.antares:eventualj:0.5")
'no.antares:eventualj:jar:0.5'
<dependency org="no.antares" name="eventualj" rev="0.5">
  <artifact name="eventualj" type="jar" />
</dependency>
@Grapes(
@Grab(group='no.antares', module='eventualj', version='0.5')
)
libraryDependencies += "no.antares" % "eventualj" % "0.5"
[no.antares/eventualj "0.5"]

Зависимости

compile (2)

Идентификатор библиотеки Тип Версия
com.googlecode.lambdaj : lambdaj jar 2.3.1
com.google.code.tempus-fugit : tempus-fugit jar 1.0

test (2)

Идентификатор библиотеки Тип Версия
junit : junit-dep jar 4.10
org.hamcrest : hamcrest-core jar 1.2

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

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

eventualj

Eventual assertions, for Java.
Making asynchronous assertions elegant.

What is eventualj

eventualj is an extension for hamcrest's Matchers that allows support for matching temporal values. Often you will come across such scenarios when testing multi-threaded applications.

Imagine the scenario where your application consumes messages from queues asynchronously. You want to test that when you put a message on the inbound queue it gets consumed. Because the message is consumed asynchronous you can't write an immediate assertion. Wouldn't it be nice if you could just write:

whenIPutAMessageOnThe(inboundQueue);
assertThat(eventually(inboundQueue).isEmpty(), willBe(true));

How it works

eventualj's eventually method returns a type safe proxy allowing you write a test asserting against the return value of one of its methods. Or more specifically, its eventual value.

Because the eventually proxy is type safe, you get all your usual IDE refactoring and autocompletion features for free.

Examples

assertThat(eventually(ten()).getValue(), willBe(10)); // passes
assertThat(ten().getValue(), is(10)); // fails, ten()'s value hasn't been set yet
assertThat(eventually(messageQueue).isEmpty(), willBe(true).within(millis(100))); // passes eventually

For a more complete example see the Queue producer and consumer example test here

Maven projects

eventualj isn't currently released in a public maven repository. If you want it, stop by and add a plus 1 to the issue

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

Версия
0.5