Refactored the database tests.