Chapter 10. Testing and JDBC
This chapter covers
- Which parts of your JDBC client code not to test
- Testing your mapping between domain objects and ResultSets
- Verifying SQL commands with the Gold Master technique
- Using database meta data to write simpler tests
- Managing test data in different databases and using DbUnit
- Testing legacy JDBC code
There are those who would say that the database is the core of any “real” Java application. Although applications need data, many people have designed applications around the database, as though it were the center of the universe. This leads to high coupling between the application and its data sources and, as we have been saying throughout, high coupling and duplication are primary sources of frustration during Programmer Testing. In this chapter we present strategies and techniques for testing data components as well as offering ways to refactor your application towards a more testable design.