Skip to content

Allow use of module-info.java files in unit (whitebox) tests  #18

@brianoliver

Description

@brianoliver

Perhaps I'm missing something here, but it would be nice to allow dependencies to be specified for white box (unit) tests using a module-info.java file instead of having to customize the gradle.build files with kotlin (etc) code.

eg: instead of writing the following:

javaModuleTesting.whitebox(
	testing.suites.getByName<JvmTestSuite>("test") {
		useJUnitJupiter()
		targets.all { testTask { testLogging.showStandardStreams = true } }
	}
) {
	// Modular Dependencies for White Box (unit testing)
	requires.add("org.junit.jupiter.api")
	requires.add("org.junit.jupiter.engine")

	requires.add("org.hamcrest")
        ...
}

It would be nice to be able to write the following module-info.java in the unit test folder, but importantly only when the module name for the unit test exactly matches the name of the main module-info.java file.

// module-info.java in the test/ folder for the module my.app
module my.app {
    requires org.junit.jupiter.api;
    requires org.junit.juptier.engine;
    requires org.hamcrest;
    ...
}

More precisely, we could use the fact that when the module-info.java module name for the white box test exactly matches the module name for the (main) module, we know we have to patch the modules together?

This would even further allow avoiding Gradle dependency hell.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions