I\'ve written a factory to produce java.sql.Connection objects:
java.sql.Connection
public class MySQLDatabaseConnectionFactory implements DatabaseConnectionFactory
There is an easy solution by using java FunctionalInterface and then add that interface as dependency for the class you are trying to unit test.