### Question:
SortedDetailResultQuery extends AbstractDetailResultQuery { @Override public DetailQueryResultSet merge(List<DetailQueryResultSet> queryResultSets) { return new MergeSortedDetailQueryResultSet(fetchSize, createRowComparator(comparators), queryResultSets); } SortedDetailResultQuery(int fetchSize, List<Query<DetailQueryResultSet>> queries, List<Pair<Sort, ColumnTypeConstants.ClassType>> comparators);  SortedDetailResultQuery(int fetchSize, List<Query<DetailQueryResultSet>> queries, List<DetailTarget> targets,
                                   List<Pair<Sort, ColumnTypeConstants.ClassType>> comparators); @Override DetailQueryResultSet merge(List<DetailQueryResultSet> queryResultSets);  }### Answer:
@Test public void merge() throws Exception { int fetchSize = mock(Integer.class); List queries = mock(List.class); List comparators = mock(List.class); List queryResultSets = mock(List.class); Comparator comparator = mock(Comparator.class); mockStatic(SortedDetailResultQuery.class); doReturn(comparator).when(SortedDetailResultQuery.class); Whitebox.invokeMethod(SortedDetailResultQuery.class, "createRowComparator", comparators); MergeSortedDetailQueryResultSet mergeDetailQueryResultSet = mock(MergeSortedDetailQueryResultSet.class); whenNew(MergeSortedDetailQueryResultSet.class).withArguments(fetchSize, comparator, queryResultSets).thenReturn(mergeDetailQueryResultSet); Assert.assertEquals(mergeDetailQueryResultSet, new SortedDetailResultQuery(fetchSize, queries, comparators).merge(queryResultSets)); }