AssertJ-JavaFX

AssertJ-JavaFX is a collection of AssertJ assertions for JavaFX to simplify the development of JavaFX based applications. At the moment the focus is on JavaFX's Properties and Bindings.

To use the library simply add the dependency to your gradle or maven project:

Gradle:

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

Maven:

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

If you have ideas or wishes for new useful assertions I would be very pleased to hear them. Feel free to add an issue at the github issue tracker

You can find the source code on github: https://github.com/lestard/assertj-javafx

The JavaDoc can be found here: https://lestard.github.io/assertj-javafx/javadoc/0.3.0/

Related Articles:

  • AssertJ-JavaFX

    | tagged as
    Summary:

    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.
    ...