TestFX icon indicating copy to clipboard operation
TestFX copied to clipboard

Why I must include AssertJ as an explicit dependency to use TestFX 4.0.18 Assertions with Junit4?

Open claudio-rosati opened this issue 1 year ago • 3 comments

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

claudio-rosati avatar May 28 '24 08:05 claudio-rosati

It seems because of testfx-junit.gradle#L86) was commented in favour of line 85.

claudio-rosati avatar May 31 '24 08:05 claudio-rosati

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.

mvsoder avatar Jun 08 '24 17:06 mvsoder

I think the problem is in the gradle file, specifically testfx-junit.gradle at line 86.

claudio-rosati avatar Jun 10 '24 08:06 claudio-rosati