I'm relatively new to unit testing, and I've discovered that while many sources say that you should write unit tests, few of them give any indication where to put them in your project.
The only suggestions that I've seen are to put them alongside the production code or to build a directory structure that mirrors your production code. The problem I see with the first approach is that it would become difficult to extract those tests when you make a full build of the system; for the second, how would you test functionality that is only visible at the package level?
Is there a decent way to organize unit tests so that you can easily automate the build process and still access everything that needs to be tested?
EDIT: For those wondering about a specifc language, I'm mostly working in Java. However, I'd like to find a solution that's relatively language-agnostic so I can apply it regardless of what platform I'm working on.