private void compareQueryResultsWithExternallySortedResults(SelectResults sr,
      Object[] externallySorted, String query, Wrapper wrapper) {

    if (sr.size() == externallySorted.length) {
      CacheUtils.log("Both SelectResults are of Same Size i.e.  Size= " + sr.size());
    } else {
      fail("FAILED:SelectResults size is different in both the cases. Size1=" + sr.size()
          + " Size2 = " + externallySorted.length + "; failed query=" + query);
    }

    Collection coll1 = null;
    coll1 = sr.asList();
    int j = 0;
    if (wrapper.validationLevel != ValidationLevel.ORDER_BY_ONLY) {
      for (Object o : externallySorted) {
        boolean removed = coll1.remove(o);
        if (!removed) {
          LogWriter logger = CacheUtils.getLogger();
          logger.error("order by inconsistency at element index = " + j);
          logger.error(" query result =****");
          logger.error(" query result =" + coll1);
          logger.error(" query result elementType=" + sr.getCollectionType().getElementType());
          logger.error(" externally sorted result =****");
          logger.error(ArrayUtils.toString(externallySorted));

          fail("failed query due to element mismatch=" + query);
        }
        ++j;
      }
      assertTrue(coll1.isEmpty());
    }

    if (wrapper.validationLevel != ValidationLevel.MATCH_ONLY) {
      coll1 = sr.asList();
      Iterator itert1 = coll1.iterator();
      int i = 0;
      for (Object o : externallySorted) {

        if (wrapper.obc.compare(o, itert1.next()) != 0) {
          LogWriter logger = CacheUtils.getLogger();
          logger.error("order by inconsistency at element index = " + i);
          logger.error(" query result =****");
          logger.error(" query result =" + coll1);
          logger.error(" externally sorted result =****");
          logger.error(ArrayUtils.toString(externallySorted));
          fail("failed query due to order mismatch=" + query);
        }
        ++i;
      }
    }
  }
Used by these tests:
<ul>
<li>EquiJoinIntegrationTest</li>
<li>IUMRCompositeIteratorJUnitTest</li>
<li>IUMRMultiIndexesMultiRegionJUnitTest</li>
<li>IUMRShuffleIteratorsJUnitTest</li>
<li>IUMRSingleRegionJUnitTest</li>
<li>IndexCreationJUnitTest</li>
<li>IndexHintJUnitTest</li>
<li>IndexMaintainceJUnitTest</li>
<li>IndexUseJUnitTest</li>
<li>IndexedMergeEquiJoinScenariosJUnitTest</li>
<li>MultiRegionIndexUsageJUnitTest</li>
<li>NonDistinctOrderByPartitionedJUnitTest</li>
<li>NonDistinctOrderByReplicatedJUnitTest</li>
<li>NonDistinctOrderByTestImplementation</li>
<li>OrderByPartitionedJUnitTest</li>
<li>OrderByReplicatedJUnitTest</li>
<li>OrderByTestImplementation</li>
<li>QueryIndexUsingXMLDUnitTest</li>
<li>QueryREUpdateInProgressJUnitTest</li>
<li>QueryUsingFunctionContextDUnitTest</li>
<li>QueryUsingPoolDUnitTest</li>
<li>TestNewFunctionSSorRSIntegrationTest</li>
</ul>
Also used by:
<ul>
<li>GroupByTestImpl</li>
<li>PdxGroupByTestImpl</li>
<li>PRQueryDUnitHelper</li>
</ul>
geode-junit/src/main/java/org/apache/geode/cache/query/functional/StructSetOrResultsSet.java