In Java, you should use Junit4, either on your own, or (I think better) with an IDE. We used three environments: Eclipse, NetBeans, and Maven (with and without an IDE). There may be a slight incompatibility between them if the system is not deployed systematically.
As a rule, all tests are in one project, but in a different directory / folder. Thus, the class:
org.foo.Bar.java
will have a test
org.foo.BarTest.java
They are in the same package (org.foo), but will be organized in directories:
src/main/java/org/foo/Bar.java
and
src/test/java/org/foo/BarTest.java
These directories are recognized by Eclipse, NetBeans, and Maven. Maven is the most picky, while Eclipse does not always provide rigor.
You should probably avoid calling the other TestPlugh or XyzzyTest classes, as some (old) tools will select them as containing tests, even if they do not.
Even if you have only one test for your method (and most testing authorities would have expected more extreme cases), you should organize this type of structure.
EDIT Please note that Maven can create distributions without tests, even if they are in the same package. By default, Maven also requires that all tests pass before the project is deployed.
source share