### Question:
JdbcMetadataHandler extends MetadataHandler { @Override public ListTablesResponse doListTables(final BlockAllocator blockAllocator, final ListTablesRequest listTablesRequest) { try (Connection connection = jdbcConnectionFactory.getConnection(getCredentialProvider())) { LOGGER.info("{}: List table names for Catalog {}, Table {}", listTablesRequest.getQueryId(), listTablesRequest.getCatalogName(), listTablesRequest.getSchemaName()); return new ListTablesResponse(listTablesRequest.getCatalogName(), listTables(connection, listTablesRequest.getSchemaName())); } catch (SQLException sqlException) { throw new RuntimeException(sqlException.getErrorCode() + ": " + sqlException.getMessage()); } } protected  JdbcMetadataHandler(); protected  JdbcMetadataHandler(final DatabaseConnectionConfig databaseConnectionConfig, final JdbcConnectionFactory jdbcConnectionFactory); @VisibleForTesting protected  JdbcMetadataHandler(final DatabaseConnectionConfig databaseConnectionConfig, final AWSSecretsManager secretsManager,
            final AmazonAthena athena, final JdbcConnectionFactory jdbcConnectionFactory); @Override ListSchemasResponse doListSchemaNames(final BlockAllocator blockAllocator, final ListSchemasRequest listSchemasRequest); @Override ListTablesResponse doListTables(final BlockAllocator blockAllocator, final ListTablesRequest listTablesRequest); @Override GetTableResponse doGetTable(final BlockAllocator blockAllocator, final GetTableRequest getTableRequest); abstract Schema getPartitionSchema(final String catalogName); @Override abstract void getPartitions(
            final BlockWriter blockWriter,
            final GetTableLayoutRequest request, QueryStatusChecker queryStatusChecker); @Override abstract GetSplitsResponse doGetSplits(BlockAllocator blockAllocator, GetSplitsRequest getSplitsRequest);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void doListTablesEscapedException() throws SQLException { Mockito.when(connection.getMetaData().getSearchStringEscape()).thenReturn("_"); this.jdbcMetadataHandler.doListTables(this.blockAllocator, new ListTablesRequest(this.federatedIdentity, "testQueryId", "testCatalog", "test_Schema")); }
@Test public void doListTables() throws SQLException { String[] schema = {"TABLE_SCHEM", "TABLE_NAME"}; Object[][] values = {{"testSchema", "testTable"}, {"testSchema", "testtable2"}}; TableName[] expected = {new TableName("testSchema", "testTable"), new TableName("testSchema", "testtable2")}; AtomicInteger rowNumber = new AtomicInteger(-1); ResultSet resultSet = mockResultSet(schema, values, rowNumber); Mockito.when(connection.getMetaData().getTables("testCatalog", "testSchema", null, new String[] {"TABLE", "VIEW"})).thenReturn(resultSet); Mockito.when(connection.getCatalog()).thenReturn("testCatalog"); ListTablesResponse listTablesResponse = this.jdbcMetadataHandler.doListTables( this.blockAllocator, new ListTablesRequest(this.federatedIdentity, "testQueryId", "testCatalog", "testSchema")); Assert.assertArrayEquals(expected, listTablesResponse.getTables().toArray()); }