PostgresqlConnectionFactory implements DbUnitConnectionFactory { @Override public IDatabaseConnection createConnection(final Connection connection, final String schema) throws DatabaseUnitException { final IDatabaseConnection dbUnitConnection = new DatabaseConnection(connection, schema); dbUnitConnection.getConfig().setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new PostgresqlDataTypeFactory()); return dbUnitConnection; }  @Override boolean supportsDriver(final String driverClass); @Override IDatabaseConnection createConnection(final Connection connection, final String schema);  }
@Test public void testCreateConnection() throws DatabaseUnitException { final String schema = "foo"; final IDatabaseConnection dbConnection = FACTORY.createConnection(connection, schema); assertThat(dbConnection, notNullValue()); final Object typeFactory = dbConnection.getConfig().getProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY); assertThat(typeFactory, notNullValue()); assertThat(typeFactory.getClass(), not(equalTo(DefaultDataTypeFactory.class))); assertThat(dbConnection.getSchema(), equalTo(schema)); }