Testing, shims and package private classes
John Hendrikx
john.hendrikx at gmail.com
Tue Dec 13 08:55:27 UTC 2022
Hi all,
I was wondering, is there a reason for the current test setup in the
JavaFX code base?
Currently, tests are all stored under src/test/java under a special
package name prefixed with "test". This is an (IMHO) unusual practice as
normally tests mirror the same packages as their main classes to aid in
testability. Testing a package private class is really hard because of
this and requires the use of a shim -- the shims do mirror the same
package hierarchy as the main classes.
A few questions related to this:
1) When testing a package private class in the com.sun.* hierarchy, is
it okay to just make the class public (as it is already private API) so
it can be tested without a shim?
2) Can at least the com.sun.* hierarchy be mirrored in src/test/java
without the "test" package prefix? Again, they're both non-public
packages anyway.
3) Can we perhaps move all test classes to the package of their main
counterparts, and do away with (probably all) shims?
--John
More information about the openjfx-dev
mailing list