@Test
public void prepareDataSourceWithBasicInfo() throws SQLException {

    // Mock data source properties
    final Properties properties = new Properties();
    properties.put("PGHOST", "server");
    properties.put("PGPORT", "5000");
    final DataSourceProperties dataSource = new DataSourceProperties("user", "password", "jdbc:postgresql:");
    dataSource.setProperties(properties);
    // Test preparing data source with no catalog
    final JdbcSchemaParser parser = new PostgreSqlSchemaParser();
    DataSourceProperties prepared = parser.prepareDataSource(dataSource, null);
    Assert.assertNotEquals(dataSource, prepared);
    Assert.assertEquals("postgres", prepared.getProperties().getProperty("PGDBNAME"));
    Assert.assertEquals(dataSource.getUrl(), prepared.getUrl());
    // Test preparing data source with user-defined catalog
    prepared = parser.prepareDataSource(dataSource, "kylo");
    Assert.assertNotEquals(dataSource, prepared);
    Assert.assertEquals("kylo", prepared.getProperties().getProperty("PGDBNAME"));
    Assert.assertEquals(dataSource.getUrl(), prepared.getUrl());
}