TestFX
TestFX copied to clipboard
Why I must include AssertJ as an explicit dependency to use TestFX 4.0.18 Assertions with Junit4?
Expected Behavior
Add only the following statements to run TestFX tests (those are the 2 statements I've used to work with TestFX 4.0.16-alpha):
testImplementation group: 'org.testfx', name: 'testfx-core', version: '4.0.18'
testImplementation group: 'org.testfx', name: 'testfx-junit', version: '4.0.18'
Actual Behavior
To have TestFX 4.0.18 working I now need the following:
testImplementation group: 'org.assertj', name: 'assertj-core', version: '3.13.2'
testImplementation group: 'org.testfx', name: 'testfx-core', version: '4.0.18'
testImplementation("org.testfx:testfx-junit:4.0.18") {
exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
Otherwise I cannot use TestFX Assertions because import static org.testfx.assertions.api.Assertions.assertThat; will fail if AssertJ is not explicitly included in my dependencies.
Specifications
- Version: 4.0.18
- Platform: macOS, WIndows, Linux
It seems because of testfx-junit.gradle#L86) was commented in favour of line 85.
This appears to be an issue with the pom file marking the assertj-core dependency as a runtime dependency instead of being a "direct" dependency.
I think the problem is in the gradle file, specifically testfx-junit.gradle at line 86.