concept reuse in category java

This is an excerpt from Manning's book JUnit in Action, Second Edition.
The separation-of-concerns strategy not only permits the reuse of classes in more than one context, but it also simplifies testing. You can test the business logic class with JUnit and mock objects and use in-container testing to validate the tag class.
In the previous example, testGetUserById() fetched an object from the database and asserted its attributes, but testAddUser() did the opposite (instantiated a new object, filled its attributes, and then inserted it in the database). As your test cases grow, more and more tests will need to do the same. To avoid the DRY (don’t repeat yourself) syndrome, it’s better to create a helper class containing methods and constants for these tasks. Doing so improves reuse in the Java classes and facilitates maintenance of dataset files. If you use Java 5 and static imports, accessing members in this helper class is simple. Listing 17.8 shows a revised version of testAddUser() using this practice.