JDBC Testing Support
JdbcTestUtils
org.springframework.test.jdbc
包包含 JdbcTestUtils
,它是一系列JDBC 相关实用功能,旨在简化标准数据库测试场景。具体来说,JdbcTestUtils
提供以下静态实用方法。
The org.springframework.test.jdbc
package contains JdbcTestUtils
, which is a
collection of JDBC-related utility functions intended to simplify standard database
testing scenarios. Specifically, JdbcTestUtils
provides the following static utility
methods.
-
countRowsInTable(..)
:统计给定表中的行数。 -
countRowsInTable(..)
: Counts the number of rows in the given table. -
countRowsInTableWhere(..)
:通过使用提供的WHERE
子句来统计给定表中的行数。 -
countRowsInTableWhere(..)
: Counts the number of rows in the given table by using the providedWHERE
clause. -
deleteFromTables(..)
:从指定表中删除所有行。 -
deleteFromTables(..)
: Deletes all rows from the specified tables. -
deleteFromTableWhere(..)
:通过使用提供的WHERE
子句从给定表中删除行。 -
deleteFromTableWhere(..)
: Deletes rows from the given table by using the providedWHERE
clause. -
dropTables(..)
:删除指定表。 -
dropTables(..)
: Drops the specified tables.
|
Embedded Databases
`spring-jdbc`模块为配置和启动嵌入式数据库提供支持,你可以在与数据库交互的集成测试中使用它。有关详情,请参阅Embedded Database Support和Testing Data Access Logic with an Embedded Database。
The spring-jdbc
module provides support for configuring and launching an embedded
database, which you can use in integration tests that interact with a database.
For details, see Embedded Database Support
and Testing Data Access
Logic with an Embedded Database.