I currently am trying testing (unit test) a class that connect to the database, see the code:
public Connection getConnection() {
System.out.println("Conectando ao banco");
try {
return DriverManager.getConnection("jdbc:postgres://localhost/banco", "root", "");
} catch(SQLException e) {
throw new RuntimeException(e);
}
}
I liked know how i can mock(Jmock) it, but DriverManager isnt a interface so i cannot mock this class, so how i can make this test?