@Test
  public void testClientDestroyOfUncreatedEntry() {
    // set <true, false> means <PR=true, notifyBySubscription=false> to test local-invalidates
    int serverPort1 = server1.invoke(() -> new ServerBuilder()
        .regionShortcut(REPLICATE)
        .create());

    client1.invoke(() -> new ClientBuilder()
        .serverPorts(serverPort1)
        .create());

    // server1 add cacheWriter
    server1.invoke(() -> {
      Region<String, TickerData> region = getCache().getRegion(regionName);
      // Install cacheWriter that causes the very first destroy to fail
      region.getAttributesMutator()
          .setCacheWriter(new ActionCacheWriter<>(new Action<>(Operation.DESTROY,
              destroys -> {
                if (destroys >= 0) {
                  throw new CacheWriterException("Expected by test");
                }
              })));
      assertThat(region.size()).isZero();
    });

    // client1 destroy
    client1.invoke(() -> {
      Region<String, TickerData> region = getClientCache().getRegion(regionName);
      Throwable thrown = catchThrowable(() -> region.destroy("bogusKey"));
      assertThat(thrown)
          .isInstanceOf(ServerOperationException.class)
          .hasCauseInstanceOf(CacheWriterException.class);
    });

    server1.invoke(() -> {
      assertThat(getCache().getRegion(regionName).size()).isZero();
    });
  }
Checks to see if a client does a destroy that throws an exception from CacheWriter
beforeDestroy that the size of the region is still correct. See bug 51583.
geode-cq/src/distributedTest/java/org/apache/geode/internal/cache/PutAllClientServerDistributedTest.java