Running nested JUnit tests

John Hendrikx hjohn at
Fri Sep 17 10:33:41 UTC 2021

I would like to provide some junit tests in a PR.

These are written in a nested style for easy readability. For example:

     private StringProperty property = new SimpleStringProperty("A");

     class When_map_Called {

         class WithNull {

             void shouldThrowNullPointerException() {
                 assertThrows(NullPointerException.class, () ->;

         class WithNotNullReturns_ObservableValue_Which {
             private ObservableValue<String> observableValue =
       -> v + "Z");

             void shouldNotBeNull() {

             // etc...

         // etc..

Can this PR either:

1) Add JUnit 5 as a dependency

2) Use a custom JUnit 4 runner as a dependency that provides nested 

3) Add our own Nested runner based on an Apache 2.0 licensed one (about 
200 lines of test code).

For point 2 and 3, there is a good one here:

Please let me know, I think tests are very important and having to tools 
to write them as readable as possible would be great.


More information about the openjfx-dev mailing list