SearchResponseMapper { public SearchResponse mapResponse(final DashboardQueryKey queryKey, final stroom.query.api.v2.SearchResponse searchResponse) { if (searchResponse == null) { return null; } Set<String> highlights = null; if (searchResponse.getHighlights() != null) { highlights = new HashSet<>(searchResponse.getHighlights()); } String errors = null; if (searchResponse.getErrors() != null) { errors = searchResponse.getErrors().stream() .collect(Collectors.joining("\n")); } Map<String, ComponentResult> results = null; if (searchResponse.getResults() != null) { results = new HashMap<>(); for (final Result result : searchResponse.getResults()) { results.put(result.getComponentId(), mapResult(result)); } } return new SearchResponse(queryKey, highlights, errors, searchResponse.complete(), results); }  SearchResponse mapResponse(final DashboardQueryKey queryKey, final stroom.query.api.v2.SearchResponse searchResponse);  }
@Test void testResponse() { final SearchResponseMapper mapper = new SearchResponseMapper(); final stroom.dashboard.shared.SearchResponse result = mapper.mapResponse(null, getSearchResponse()); System.out.println(result); }