I've written a factory to produce java.sql.Connection objects:
public class MySQLDatabaseConnectionFactory implements DatabaseConnectionFactory {
@Override public Connection getConnection() {
try {
return DriverManager.getConnection(...);
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
}
I want to validate the parameters passed to DriverManager.getConnection, but I have no idea about how to mock a static method. Is there a good way to mock/verify this specific use-case?