### Question:
ElasticSearchProvider implements ExternalSearchProvider<ElasticSearchProviderTraits> { @Override public List<ExternalSearchResult> executeQuery(DocumentRepository aRepository, ElasticSearchProviderTraits aTraits, String aQuery) throws IOException { List<ExternalSearchResult> results = new ArrayList<>(); try (RestHighLevelClient client = makeClient(aTraits)) { HighlightBuilder highlightBuilder = new HighlightBuilder() .field(new HighlightBuilder.Field(aTraits.getDefaultField()) .highlighterType("unified")); SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder() .fetchSource(null, ELASTIC_HIT_DOC_KEY) .highlighter(highlightBuilder) .size(aTraits.getResultSize()); QueryBuilder qb = QueryBuilders.simpleQueryStringQuery(aQuery) .field(aTraits.getDefaultField()); if (aTraits.isRandomOrder()) { RandomScoreFunctionBuilder randomFunc = ScoreFunctionBuilders.randomFunction(); randomFunc.seed(aTraits.getSeed()); searchSourceBuilder.query(QueryBuilders.functionScoreQuery( QueryBuilders.constantScoreQuery(qb).boost(1.0f), randomFunc)); } else { searchSourceBuilder.query(qb); } SearchRequest searchRequest = new SearchRequest(aTraits.getIndexName()) .source(searchSourceBuilder); SearchResponse response = client.search(searchRequest); for (SearchHit hit: response.getHits().getHits()) { if (hit.getSourceAsMap() == null || hit.getSourceAsMap().get(ELASTIC_HIT_METADATA_KEY) == null) { log.warn("Result has no document metadata: " + hit); continue; } ExternalSearchResult result = new ExternalSearchResult(aRepository, aTraits.getIndexName(), hit.getId()); if (!aTraits.isRandomOrder()) { result.setScore((double) hit.getScore()); } fillResultWithMetadata(result, hit.getSourceAsMap()); if (hit.getHighlightFields().size() != 0) { List<ExternalSearchHighlight> highlights = new ArrayList<>(); if (hit.getHighlightFields().get(aTraits.getDefaultField()) != null) { for (Text highlight : hit.getHighlightFields() .get(aTraits.getDefaultField()) .getFragments()) { highlights.add(new ExternalSearchHighlight(highlight.toString())); } } result.setHighlights(highlights); } results.add(result); } } return results; }  @Override List<ExternalSearchResult> executeQuery(DocumentRepository aRepository,
            ElasticSearchProviderTraits aTraits, String aQuery); @Override ExternalSearchResult getDocumentResult(DocumentRepository aRepository,
            ElasticSearchProviderTraits aTraits, String aCollectionId, String aDocumentId); @Override String getDocumentText(DocumentRepository aRepository,
            ElasticSearchProviderTraits aTraits, String aCollectionId, String aDocumentId); @Override InputStream getDocumentAsStream(DocumentRepository aRepository,
            ElasticSearchProviderTraits aTraits, String aCollectionId, String aDocumentId); @Override String getDocumentFormat(DocumentRepository aRepository,
            ElasticSearchProviderTraits aTraits, String aCollectionId, String aDocumentId);  }### Answer:
@Test public void thatQueryWorks() throws Exception { List<ExternalSearchResult> results = sut.executeQuery(repo, traits, "shiny"); System.out.println(results); assertThat(results).isNotEmpty(); }