### Question:
ExampleMetadata implements ConnectorMetadata { @Override public List<SchemaTableName> listTables(ConnectorSession session, Optional<String> optionalSchemaName) { Set<String> schemaNames = optionalSchemaName.map(ImmutableSet::of) .orElseGet(() -> ImmutableSet.copyOf(exampleClient.getSchemaNames())); ImmutableList.Builder<SchemaTableName> builder = ImmutableList.builder(); for (String schemaName : schemaNames) { for (String tableName : exampleClient.getTableNames(schemaName)) { builder.add(new SchemaTableName(schemaName, tableName)); } } return builder.build(); } @Inject  ExampleMetadata(ExampleClient exampleClient); @Override List<String> listSchemaNames(ConnectorSession session); List<String> listSchemaNames(); @Override ExampleTableHandle getTableHandle(ConnectorSession session, SchemaTableName tableName); @Override ConnectorTableMetadata getTableMetadata(ConnectorSession session, ConnectorTableHandle table); @Override List<SchemaTableName> listTables(ConnectorSession session, Optional<String> optionalSchemaName); @Override Map<String, ColumnHandle> getColumnHandles(ConnectorSession session, ConnectorTableHandle tableHandle); @Override Map<SchemaTableName, List<ColumnMetadata>> listTableColumns(ConnectorSession session, SchemaTablePrefix prefix); @Override ColumnMetadata getColumnMetadata(ConnectorSession session, ConnectorTableHandle tableHandle, ColumnHandle columnHandle); @Override boolean usesLegacyTableLayouts(); @Override ConnectorTableProperties getTableProperties(ConnectorSession session, ConnectorTableHandle table);  }### Answer:
@Test public void testListTables() { assertEquals(ImmutableSet.copyOf(metadata.listTables(SESSION, Optional.empty())), ImmutableSet.of( new SchemaTableName("example", "numbers"), new SchemaTableName("tpch", "orders"), new SchemaTableName("tpch", "lineitem"))); assertEquals(ImmutableSet.copyOf(metadata.listTables(SESSION, Optional.of("example"))), ImmutableSet.of( new SchemaTableName("example", "numbers"))); assertEquals(ImmutableSet.copyOf(metadata.listTables(SESSION, Optional.of("tpch"))), ImmutableSet.of( new SchemaTableName("tpch", "orders"), new SchemaTableName("tpch", "lineitem"))); assertEquals(ImmutableSet.copyOf(metadata.listTables(SESSION, Optional.of("unknown"))), ImmutableSet.of()); }