testcontainers-java
testcontainers-java copied to clipboard
Do not use utility classes from 'org.junit.platform.commons.util'
org.junit.platform.commons.util is an internal package (see module-info.java). The compiler only knows about this if you compile as Java Module - which testcontainers does not do (yet? - #1523 / #521). That's why the compiler does not complain.
Even though testcontainers is not built as Java Modules, we can still use it to test Java Modules by allowing use of the UNNAMED module (i.e. the classpath) in addition to "real" modules.
Right now we have to add: --add-exports org.junit.platform.commons/org.junit.platform.commons.util=ALL-UNNAMED.
Independent of whether testcontainer Jars will become Java Modules or not, it would be nice if this could be fixed. There are three places in the code where utility classes from JUnit5 are used. I think these can be replaced by transferring the needed functionality into a custom utility class.
See: https://github.com/testcontainers/testcontainers-java/search?q=%22org.junit.platform.commons.util%22