### Question:
GlueMetadataHandler extends MetadataHandler { @Override public ListSchemasResponse doListSchemaNames(BlockAllocator blockAllocator, ListSchemasRequest request) throws Exception { return doListSchemaNames(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 doListSchemaNames() throws Exception { List<Database> databases = new ArrayList<>(); databases.add(new Database().withName("db1")); databases.add(new Database().withName("db2")); when(mockGlue.getDatabases(any(GetDatabasesRequest.class))) .thenAnswer((InvocationOnMock invocationOnMock) -> { GetDatabasesRequest request = (GetDatabasesRequest) invocationOnMock.getArguments()[0]; assertEquals(accountId, request.getCatalogId()); GetDatabasesResult mockResult = mock(GetDatabasesResult.class); if (request.getNextToken() == null) { when(mockResult.getDatabaseList()).thenReturn(databases); when(mockResult.getNextToken()).thenReturn("next"); } else { when(mockResult.getDatabaseList()).thenReturn(new ArrayList<>()); when(mockResult.getNextToken()).thenReturn(null); } return mockResult; }); ListSchemasRequest req = new ListSchemasRequest(IdentityUtil.fakeIdentity(), queryId, catalog); ListSchemasResponse res = handler.doListSchemaNames(allocator, req); logger.info("doListSchemas - {}", res.getSchemas()); assertEquals(databases.stream().map(next -> next.getName()).collect(Collectors.toList()), new ArrayList<>(res.getSchemas())); verify(mockGlue, times(2)).getDatabases(any(GetDatabasesRequest.class)); }