What would you consider best practice for organizing JUnit tests in a project, and why? For example, do you keep your tests next to the classes they test? Do you put them in a separate but parallel package structure? Do you use a different organization strategy entirely?
I put my tests in a seperate but similar/parallel package structure. This is how Maven likes things and it works well with IDEs too. I like it this way because I don't have my test code mixed up with my application code, yet I can still access package-private things for the purpose of mocking and state-verification.
as Bill the Lizard said,
it helps to have a parallel structure so that 1) I can ship a src.zip or src.tar.gz and leave out the unit tests 2) At a version control system level, you can put hooks on who changes source code and who changes only unit tests
"Disadvantage"
You cannot seal your JAR file if both the source and unit tests are in the same package (meaning, you need to delete the unit tests before preparing your .JAR and sealing it)
Just use Maven. With maven, you can create a default structure for your project:
mvn archetype:create -DgroupId=com.yoyodyne -DartifactId=UberApp
This will create Maven's standard directory layout containing space for unit tests as well as your main project. Using maven, you can then run the unit tests without packaging it to a jar, and you can build a jar that contains just your application. You can also have different classpaths and different dependencies for run, test and compile time.
I find it most disturbing to see so few people around here are actually using Maven (or at least Ant, though I prefer Maven for the dependency handling.)