@Override
    public void execute(FunctionContext<String> context) {
      RegionFunctionContext regionFunctionContext = (RegionFunctionContext) context;
      Set<String> keys = uncheckedCast(regionFunctionContext.getFilter());
      String lastKey = keys.iterator().next();
      keys.remove(lastKey);

      Region<String, String> region = dataSetSupplier.dataSet(regionFunctionContext);

      for (String key : keys) {
        context.getResultSender().sendResult(region.get(key));
      }

      context.getResultSender().lastResult(region.get(lastKey));
    }
This tests make sure that, in case of LonerDistributedSystem we don't get ClassCast Exception.
Just making sure that the function executed on lonerDistributedSystem.

<p>
Regression test for bug: If invoked from LonerDistributedSystem, FunctionService.onMembers()
throws ClassCastException
geode-core/src/integrationTest/java/org/apache/geode/internal/cache/execute/FunctionExecutionOnLonerRegressionTest.java