AssertJ-JavaFX

As you probably already know I’m a big fan of the AssertJ library. That’s the reason I’ve done a talk about it at the JavaUserGroup Görlitz.

I like the way you can write readable unit tests and are supported by the IDE because AssertJ is implemented as a Fluent-API.

In the past weeks I’ve written a package of assertions specially for JavaFX. With this assertions you can verify the values of JavaFX Properties and Bindings.

With the normal AssertJ you would write something like this:

DoubleProperty x = new SimpleDoubleProperty(10.13);
...

assertThat(x.get()).isEqualTo(10.13);

With my extensions you don’t need to call the .get() all the time. Instead you can write:


assertThat(x).hasValue(10.13);

Project Info

The project is hosted on github: https://github.com/lestard/assertj-javafx.

I’ve already uploaded it to maven central so you can use it with gradle:

testCompile 'eu.lestard:assertj-javafx:0.1.0'

or maven:

<dependency>
    <groupId>eu.lestard</groupId>
    <artifactId>assertj-javafx</artifactId>
    <version>0.1.0</version>
    <scope>test</scope>
</dependency>

Tell me what you think. If you have ideas for new assertions that could be added feel free to add an issue in the issue tracker.