@Test
  public void testLocalExecution_NoLastResult() throws Exception {
    PartitionedRegion pr = createPartitionedRegion(regionName, 10, 0);

    Set<String> stringKeys = new HashSet<>();
    for (int i = pr.getTotalNumberOfBuckets() * 2; i > 0; i--) {
      stringKeys.add(STRING_KEY + i);
    }

    int valueIndex = 0;
    for (String key : stringKeys) {
      int value = valueIndex++;
      pr.put(key, value);
    }

    Function<Boolean> function = new TestFunction<>(true, TEST_FUNCTION_NO_LASTRESULT);
    FunctionService.registerFunction(function);
    Execution<Boolean, Boolean, List<Boolean>> execution = FunctionService.onRegion(pr);

    ResultCollector<Boolean, List<Boolean>> resultCollector =
        execution.withFilter(stringKeys).setArguments(true).execute(function.getId());

    assertThatThrownBy(resultCollector::getResult).isInstanceOf(FunctionException.class)
        .hasMessageContaining("did not send last result");
  }
Test local execution on datastore with function that doesn't send last result.
FunctionException is expected in this case

<p>
TODO: extract to IntegrationTest
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/execute/PRFunctionExecutionWithResultSenderDUnitTest.java