SchemaMetaData { public List<String> getAllColumnNames(final String tableName) { return containsTable(tableName) ? new ArrayList<>(get(tableName).getColumns().keySet()) : Collections.emptyList(); } @SuppressWarnings("CollectionWithoutInitialCapacity")  SchemaMetaData();  SchemaMetaData(final Map<String, TableMetaData> tables); Collection<String> getAllTableNames(); TableMetaData get(final String tableName); void merge(final SchemaMetaData schemaMetaData); void put(final String tableName, final TableMetaData tableMetaData); void remove(final String tableName); boolean containsTable(final String tableName); boolean containsColumn(final String tableName, final String columnName); List<String> getAllColumnNames(final String tableName);  }
@Test public void assertGetAllColumnNamesWhenContainsKey() { TableMetaData tableMetaData = new TableMetaData(Collections.singletonList(new ColumnMetaData("col", 0, "dataType", false, false, false)), Collections.emptyList()); assertThat(new SchemaMetaData(ImmutableMap.of("tbl", tableMetaData)).getAllColumnNames("tbl"), is(Collections.singletonList("col"))); }
@Test public void assertGetAllColumnNamesWhenNotContainsKey() { TableMetaData tableMetaData = new TableMetaData(Collections.singletonList(new ColumnMetaData("col", 0, "dataType", false, false, false)), Collections.emptyList()); assertThat(new SchemaMetaData(ImmutableMap.of("tbl1", tableMetaData)).getAllColumnNames("tbl2"), is(Collections.<String>emptyList())); }