@Override
    public void responseAvailable(SearchInvoker from) {
        if (availableForProcessing != null) {
            availableForProcessing.add(from);
        }
    }
@Test
    void requireThatGroupingsAreMerged() throws IOException {
        List<SearchInvoker> invokers = new ArrayList<>();

        Grouping grouping1 = new Grouping(0);
        grouping1.setRoot(new com.yahoo.searchlib.aggregation.Group()
                .addChild(new com.yahoo.searchlib.aggregation.Group()
                        .setId(new StringResultNode("uniqueA"))
                        .addAggregationResult(new MaxAggregationResult().setMax(new IntegerResultNode(6)).setTag(4)))
                .addChild(new com.yahoo.searchlib.aggregation.Group()
                        .setId(new StringResultNode("common"))
                        .addAggregationResult(new MaxAggregationResult().setMax(new IntegerResultNode(9)).setTag(4))));
        invokers.add(new MockInvoker(0).setHits(List.of(new GroupingListHit(List.of(grouping1)))));

        Grouping grouping2 = new Grouping(0);
        grouping2.setRoot(new com.yahoo.searchlib.aggregation.Group()
                .addChild(new com.yahoo.searchlib.aggregation.Group()
                        .setId(new StringResultNode("uniqueB"))
                        .addAggregationResult(new MaxAggregationResult().setMax(new IntegerResultNode(9)).setTag(4)))
                .addChild(new com.yahoo.searchlib.aggregation.Group()
                        .setId(new StringResultNode("common"))
                        .addAggregationResult(new MinAggregationResult().setMin(new IntegerResultNode(6)).setTag(3))));
        invokers.add(new MockInvoker(0).setHits(List.of(new GroupingListHit(List.of(grouping2)))));

        try (InterleavedSearchInvoker invoker = new InterleavedSearchInvoker(Timer.monotonic, invokers, hitEstimator, dispatchConfig, new Group(0, List.of()), Set.of())) {
            invoker.responseAvailable(invokers.get(0));
            invoker.responseAvailable(invokers.get(1));
            Result result = invoker.search(query);
            assertEquals(1, ((GroupingListHit) result.hits().get(0)).getGroupingList().size());
        }
        for (SearchInvoker invoker : invokers) {
            invoker.close();
        }
    }