SimpleConnectionFactory extends AbstractConnectionFactory { @Override @SuppressWarnings("PMD.CloseResource") protected Connection getConnection(final DataSource dataSource) throws SQLException { return dataSource.getConnection(); }    }
@Test @SuppressWarnings("PMD.CloseResource") public void createConnection_should_haveDataTypeFactory() throws SQLException { final DataSource dataSource = createMock(DataSource.class); final IDataTypeFactory dataTypeFactory = createMock(IDataTypeFactory.class); final Connection conn = EasyMock.createNiceMock(Connection.class); connectionFactory.setDataSource(dataSource); connectionFactory.setDataTypeFactory(dataTypeFactory); expect(dataSource.getConnection()).andReturn(conn); replayAll(); final IDatabaseConnection connection = connectionFactory.createConnection(); final IDataTypeFactory actual = (IDataTypeFactory) connection.getConfig().getProperty("http: assertThat(actual, is(dataTypeFactory)); verifyAll(); }