### Question:
ElasticsearchMetadataEngine extends CommonsMetadataEngine<Client> { @Override @TimerJ protected void createTable(TableMetadata tableMetadata, Connection<Client> connection) throws UnsupportedException, ExecutionException { String indexName = tableMetadata.getName().getCatalogName().getName(); XContentBuilder xContentBuilder = contentBuilder.createTypeSource(tableMetadata); IndicesAdminClient indicesClient= recoveredClient(connection).admin().indices(); indicesClient .preparePutMapping() .setIndices(indexName) .setType(tableMetadata.getName().getName()) .setSource(xContentBuilder) .execute() .actionGet(); } ElasticsearchMetadataEngine(ConnectionHandler connectionHandler);   }### Answer:
@Test public void testCreateTable() throws Exception { TableName tableName = new TableName(INDEX_NAME, TYPE_NAME); Map<Selector, Selector> options = new HashMap<>(); java.util.LinkedHashMap<ColumnName, ColumnMetadata> columns = new java.util.LinkedHashMap<>(); Map<IndexName, IndexMetadata> indexes = new HashMap<IndexName, IndexMetadata>(); LinkedList<ColumnName> partitionKey = new LinkedList<ColumnName>(); LinkedList<ColumnName> clusterKey = new LinkedList<ColumnName>(); TableMetadata tableMetadata = new TableMetadata(tableName, options, columns, indexes, new ClusterName(CLUSTER_NAME), partitionKey, clusterKey); XContentBuilder xContentBuilder = mock(XContentBuilder.class); when(deepContentBuilder.createTypeSource(tableMetadata)).thenReturn(xContentBuilder); PutMappingRequestBuilder putMappingRequest = mock(PutMappingRequestBuilder.class); when(putMappingRequest.setIndices(INDEX_NAME)).thenReturn(putMappingRequest); when(putMappingRequest.setType(TYPE_NAME)).thenReturn(putMappingRequest); when(putMappingRequest.setSource(xContentBuilder)).thenReturn(putMappingRequest); ListenableActionFuture<PutMappingResponse> listenableActionFuture = mock(ListenableActionFuture.class); when(putMappingRequest.execute()).thenReturn(listenableActionFuture); IndicesAdminClient indicesAdminClient = mock(IndicesAdminClient.class); when(indicesAdminClient.preparePutMapping()).thenReturn(putMappingRequest); AdminClient adminClient = mock(AdminClient.class); when(adminClient.indices()).thenReturn(indicesAdminClient); when(client.admin()).thenReturn(adminClient); elasticsearchMetadataEngine.createTable(new ClusterName(CLUSTER_NAME), tableMetadata); verify(listenableActionFuture, times(1)).actionGet(); }