### Question:
GlueMetadataHandler extends MetadataHandler { @Override public ListTablesResponse doListTables(BlockAllocator blockAllocator, ListTablesRequest request) throws Exception { return doListTables(blockAllocator, request, null); } GlueMetadataHandler(boolean disable, String sourceType);  GlueMetadataHandler(AWSGlue awsGlue, String sourceType); @VisibleForTesting protected  GlueMetadataHandler(AWSGlue awsGlue,
            EncryptionKeyFactory encryptionKeyFactory,
            AWSSecretsManager secretsManager,
            AmazonAthena athena,
            String sourceType,
            String spillBucket,
            String spillPrefix); @Override ListSchemasResponse doListSchemaNames(BlockAllocator blockAllocator, ListSchemasRequest request); @Override ListTablesResponse doListTables(BlockAllocator blockAllocator, ListTablesRequest request); @Override GetTableResponse doGetTable(BlockAllocator blockAllocator, GetTableRequest request); static final String SOURCE_TABLE_PROPERTY; static final String COLUMN_NAME_MAPPING_PROPERTY; static final String DATETIME_FORMAT_MAPPING_PROPERTY; static final String DATETIME_FORMAT_MAPPING_PROPERTY_NORMALIZED; static final String VIEW_METADATA_FIELD; }### Answer:
@Test public void doListTables() throws Exception { List<Table> tables = new ArrayList<>(); tables.add(new Table().withName("table1")); tables.add(new Table().withName("table2")); when(mockGlue.getTables(any(GetTablesRequest.class))) .thenAnswer((InvocationOnMock invocationOnMock) -> { GetTablesRequest request = (GetTablesRequest) invocationOnMock.getArguments()[0]; assertEquals(accountId, request.getCatalogId()); assertEquals(schema, request.getDatabaseName()); GetTablesResult mockResult = mock(GetTablesResult.class); if (request.getNextToken() == null) { when(mockResult.getTableList()).thenReturn(tables); when(mockResult.getNextToken()).thenReturn("next"); } else { when(mockResult.getTableList()).thenReturn(new ArrayList<>()); when(mockResult.getNextToken()).thenReturn(null); } return mockResult; }); ListTablesRequest req = new ListTablesRequest(IdentityUtil.fakeIdentity(), queryId, catalog, schema); ListTablesResponse res = handler.doListTables(allocator, req); logger.info("doListTables - {}", res.getTables()); Set<String> tableNames = tables.stream().map(next -> next.getName()).collect(Collectors.toSet()); for (TableName next : res.getTables()) { assertEquals(schema, next.getSchemaName()); assertTrue(tableNames.contains(next.getTableName())); } assertEquals(tableNames.size(), res.getTables().size()); }