SE450: JUnit: Setting up your source tree [39/41] Previous pageContentsNext page

Problem
We need to have test code that can fully test our code but don't want to expose all of it via public interfaces (this breaks encapsulation, after all!), but we also don't want to deploy our test cases into production with all the rest of our code.

Solution We can do this by keeping our source code in a separate directory and using standard naming conventions. Then we can compile our test classes and do unit testing, then delete them and rebuild without them at any time. By putting code in the same package, we can expose the implementation of our code to the test code easily.

You should follow the following coding conventions when writing tests for this class:

Previous pageContentsNext page