I\'ve written a factory to produce java.sql.Connection objects:
java.sql.Connection
public class MySQLDatabaseConnectionFactory implements DatabaseConnectionFactory
I also wrote a combination of Mockito and AspectJ: https://github.com/iirekm/varia/tree/develop/ajmock
Your example becomes:
when(() -> DriverManager.getConnection(...)).thenReturn(...);