用Mockito模拟静态方法
java.sql.Connection
public class MySQLDatabaseConnectionFactory implements DatabaseConnectionFactory {
@Override public Connection getConnection() {
try {
return DriverManager.getConnection(...);
} catch (SQLException e) {
throw new RuntimeException(e);
}
}}DriverManager.getConnection
www说
慕无忌1623718
相关分类