用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
随时随地看视频慕课网APP
相关分类