test paths in repo

John Rose john.r.rose at oracle.com
Thu Sep 4 19:55:39 UTC 2014


David Chase and I just noticed files like this in the JDK:
  http://hg.openjdk.java.net/jdk9/jdk9/jdk/file/tip/test/java/util/stream/test/org/openjdk/tests/java/util/stream/

The package for the test code is "org.openjdk.tests.java.util.stream".  Although that's long, it is completely unambiguous.

Generally, grammar of such paths appears to be:
  $REPO / test / $TEST_PACKAGE_PREFIX / $API_PACKAGE
where TEST_PACKAGE_PREFIX is fixed as "org/openjdk/tests", and API_PACKAGE is "java/util/stream" or some such.

Has this organization for tests worn well?  Would you do it again that way?

Also, What is the reason for the close correspondence between the file system pathname and the Java package declaration?  Is it so that IDEs can easily find the test files?  (If so, which IDEs?)

For David's Arrays 2.0 work, which in some ways resembles the streams work, we want a good organization for tests, so we are looking at the streams tests as a template.

Thanks for any insights...
— John


More information about the core-libs-dev mailing list