Chapter 3. Organizing and building JUnit tests
This chapter covers
- Deciding where to place production code and test code
- Dealing with duplicate test code
- Organizing special case tests
- Building tests in various development environments
Once you understand the fundamentals of writing JUnit tests, the next step is to begin writing them. Once you open your favorite Java editor and begin writing test code, you need to decide into which package you should place the test code. Although this decision seems simple enough, there is a considerable difference between placing your test code in the same package as your production code or in a different package. For that reason, we offer a few recipes to help you decide which to do.
1 We will use ...