The org.springframework.test.jdbc package contains JdbcTestUtils, which is a set of JDBC-related utility functions designed to simplify common database testing scenarios. Specifically, JdbcTestUtils provides the following static methods.

  • countRowsInTable(..): Counts the number of rows in the given table.

  • countRowsInTableWhere(..): Counts the number of rows in the given table using the provided WHEREclause.

  • deleteFromTables(..): Deletes all rows from the specified tables.

  • deleteFromTableWhere(..): Deletes rows from the specified table using the provided WHERE clause.

  • dropTables(..): Drops the specified tables.

AbstractTransactionalJUnit4SpringContextTests and AbstractTransactionalTestNGSpringContextTests provide helper methods that delegate the above methods to JdbcTestUtils.

See section "JUnit 4 Helper Classes"