@Test(expected = IllegalArgumentException.class) public void testThatGetTableMethodThrowsExceptionOnEmptyStringInput() { Catalog catalog = new Catalog("test-db"); catalog.getTable(""); }
public Table getTable(String tableName) { checkArgument(!Strings.isNullOrEmpty(tableName), "You must specify a 'tableName'"); return tables.stream() .filter(t -> t.getName().equals(tableName)) .findFirst() .orElseThrow(() -> new IllegalStateException( "Catalog: " + name + " does not contain a table: " + tableName)); }
Catalog implements Copyable<Catalog> { public Table getTable(String tableName) { checkArgument(!Strings.isNullOrEmpty(tableName), "You must specify a 'tableName'"); return tables.stream() .filter(t -> t.getName().equals(tableName)) .findFirst() .orElseThrow(() -> new IllegalStateException( "Catalog: " + name + " does not contain a table: " + tableName)); } }
Catalog implements Copyable<Catalog> { public Table getTable(String tableName) { checkArgument(!Strings.isNullOrEmpty(tableName), "You must specify a 'tableName'"); return tables.stream() .filter(t -> t.getName().equals(tableName)) .findFirst() .orElseThrow(() -> new IllegalStateException( "Catalog: " + name + " does not contain a table: " + tableName)); } Catalog(String name); }
Catalog implements Copyable<Catalog> { public Table getTable(String tableName) { checkArgument(!Strings.isNullOrEmpty(tableName), "You must specify a 'tableName'"); return tables.stream() .filter(t -> t.getName().equals(tableName)) .findFirst() .orElseThrow(() -> new IllegalStateException( "Catalog: " + name + " does not contain a table: " + tableName)); } Catalog(String name); Catalog addTable(Table table); boolean containsTable(String tableName); Table getTable(String tableName); Table removeTable(String tableName); Catalog addView(View view); boolean containsView(String viewName); View getView(String viewName); View removeView(String viewName); Catalog addSequence(Sequence sequence); Sequence removeSequence(String sequenceName); ImmutableSet<Table> getTables(); ImmutableSet<View> getViews(); ImmutableSet<ForeignKey> getForeignKeys(); ImmutableSet<Index> getIndexes(); @Override Catalog copy(); @Override String toString(); Set<String> getTablesReferencingTable(String tableName); }
Catalog implements Copyable<Catalog> { public Table getTable(String tableName) { checkArgument(!Strings.isNullOrEmpty(tableName), "You must specify a 'tableName'"); return tables.stream() .filter(t -> t.getName().equals(tableName)) .findFirst() .orElseThrow(() -> new IllegalStateException( "Catalog: " + name + " does not contain a table: " + tableName)); } Catalog(String name); Catalog addTable(Table table); boolean containsTable(String tableName); Table getTable(String tableName); Table removeTable(String tableName); Catalog addView(View view); boolean containsView(String viewName); View getView(String viewName); View removeView(String viewName); Catalog addSequence(Sequence sequence); Sequence removeSequence(String sequenceName); ImmutableSet<Table> getTables(); ImmutableSet<View> getViews(); ImmutableSet<ForeignKey> getForeignKeys(); ImmutableSet<Index> getIndexes(); @Override Catalog copy(); @Override String toString(); Set<String> getTablesReferencingTable(String tableName);  }