### Question:
GroupResultQuery extends AbstractResultQuery<QueryResultSet<GroupPage>> { @Override public QueryResultSet<GroupPage> merge(List<QueryResultSet<GroupPage>> resultSets) { return new MergeGroupQueryResultSet(fetchSize, isGlobalIndexed, resultSets, aggregators, getComparators(comparators)); } GroupResultQuery(int fetchSize, List<Query<QueryResultSet<GroupPage>>> queries, List<Aggregator> aggregators,
                            List<Pair<SortType, ColumnTypeConstants.ClassType>> comparators, boolean[] isGlobalIndexed); @Override QueryResultSet<GroupPage> merge(List<QueryResultSet<GroupPage>> resultSets);  }### Answer:
@Test public void merge() throws Exception { List<Query<QueryResultSet<GroupPage>>> queries = Arrays.<Query<QueryResultSet<GroupPage>>>asList(mock(Query.class), mock(Query.class)); List<Aggregator> aggregators = mock(List.class); List<Pair<SortType, ColumnTypeConstants.ClassType>> comparators = Arrays.asList( Pair.of(SortType.DESC, ClassType.LONG), Pair.of(SortType.ASC, ClassType.STRING) ); boolean[] isGlobalIndexed = new boolean[0]; List<QueryResultSet<GroupPage>> resultSets = new ArrayList<QueryResultSet<GroupPage>>(); for (Query<QueryResultSet<GroupPage>> query : queries) { QueryResultSet<GroupPage> resultSet = mock(QueryResultSet.class); resultSets.add(resultSet); when(query.getQueryResult()).thenReturn(resultSet); } MergeGroupQueryResultSet mergeGroupQueryResultSet = mock(MergeGroupQueryResultSet.class); whenNew(MergeGroupQueryResultSet.class) .withArguments(eq(1), eq(isGlobalIndexed), eq(resultSets), eq(aggregators), argThat(new ArgumentMatcher<List<Comparator<?>>>() { @Override public boolean matches(List<Comparator<?>> argument) { assertThat(argument).hasSize(2) .extracting("comparator") .containsExactly(Comparators.desc(), Comparators.STRING_ASC); return true; } })) .thenReturn(mergeGroupQueryResultSet); assertThat(new GroupResultQuery(1, queries, aggregators, comparators, isGlobalIndexed).merge(resultSets)) .isEqualTo(mergeGroupQueryResultSet); }