@SuppressWarnings("CollectionWithoutInitialCapacity")
    public static Collection<IndexMetaData> load(final Connection connection, final String table) throws SQLException {
        Map<String, IndexMetaData> result = new HashMap<>();
        try (ResultSet resultSet = connection.getMetaData().getIndexInfo(connection.getCatalog(), connection.getSchema(), table, false, false)) {
            while (resultSet.next()) {
                String indexName = resultSet.getString(INDEX_NAME);
                if (null == indexName) {
                    continue;
                }
                if (!result.containsKey(indexName)) {
                    IndexMetaData indexMetaData = new IndexMetaData(indexName);
                    indexMetaData.getColumns().add(resultSet.getString("COLUMN_NAME"));
                    indexMetaData.setUnique(!resultSet.getBoolean("NON_UNIQUE"));
                    result.put(indexName, indexMetaData);
                } else {
                    result.get(indexName).getColumns().add(resultSet.getString("COLUMN_NAME"));
                }
            }
        } catch (final SQLException ex) {
            if (ORACLE_VIEW_NOT_APPROPRIATE_VENDOR_CODE != ex.getErrorCode()) {
                throw ex;
            }
        }
        return result.values();
    }
@Test
    void assertLoad() throws SQLException {
        Collection<IndexMetaData> actual = IndexMetaDataLoader.load(mockConnection(), "tbl");
        assertThat(actual.size(), is(1));
        IndexMetaData indexMetaData = actual.iterator().next();
        assertThat(indexMetaData.getName(), is("my_index"));
    }