protected ArrayList runQueryOnServerReg(String queryStr) {

    QueryService qservice = CacheFactory.getAnyInstance().getQueryService();

    Query query = qservice.newQuery(queryStr);
    SelectResults results = null;
    try {
      results = (SelectResults) query.execute();
    } catch (Exception e) {
      e.printStackTrace();
    }
    return results != null ? (ArrayList) results.asList() : null;
  }
Run query on server to compare the results received from client function execution.
geode-core/src/distributedTest/java/org/apache/geode/cache/query/dunit/QueryUsingFunctionContextDUnitTest.java