Closed tobias-trozowski closed 7 years ago
Is there a use case for injecting a different DriverManager
factory? The coupling is acceptable IMO as the entire purpose of the method is to factory the Connection
... And DriverManager::getConnection(..)
is the usual way. It's not like the parameters are not configurable, so all you'd be changing is how the Connection
is created? Maybe I missed the point?
I'm not sure what other people think about but for me it just doesn't feels the right way to use DriverManager::getConnection to create the connection.
By using the static method to create the connection we create a unresolvable dependency. And by creating such dependencies people seemed to be forced to write tests like ConnectionFactoryTest.
Basicially we have a integration test in testDefaultsThroughException.
So, what do you think about decouple this a bit more?