Java unit tests, directory layout

Viewed 82016

When building a suite of unit tests for Java code, is there a convention for where to place test code in relation to source code?

For example, if I have a directory /java that contains a bunch of .java source files, is it better to put the test cases in /java itself or use something like /java/test.

If the latter is preferred, how do you test the internals of the code when the private /protected members of a class aren't available outside the package?

6 Answers
Related