Re: Surefire and Java Modules

"Martin Desruisseaux via users" <[email protected]> Fri, 10 Apr 2026 11:44:22 +0200
Newsgroups gmane.comp.jakarta.turbine.maven.user
Message-ID <[email protected]>
Hello Mirko

Le 10/04/2026 à 11:27, Mirko Friedenhagen a écrit :
> I understood Jochen wanted to test whether the module separation does work. Do you know whether failsafe could be used for this?

I'm less familiar with Failsafe, so I do not really know. However, 
independently of the plugin, testing with module separation or not is 
sometime referred as "black box" testing versus "white box" testing 
(maybe other terminology exists also). A "white box" testing is a test 
suite having access to the internal API of the library that we want to 
test, either package-private classes or non-exported modules. It 
requires the use of `--patch-modules` or `--add-exports` options by both 
the Maven Compiler plugin and the Maven Surefire plugin. On the other 
side, a "black box" testing is a test suite which is run with the module 
separation enforced (i.e., no access to internal API).

I think that "black box" testing should be easy to do with any version 
of Maven. We can just run the tests in a separated module which declares 
the library that we want to test as an ordinary dependency, like any 
other projects. "White box" testing is more difficult and is the testing 
that requires support from the Maven plugins.

     Martin