@Test
  public void testLocalCacheLoader() {
    final String name = getUniqueName();
    final Object key = "KEY";
    final Object value = "VALUE";

    vm0.invoke("Create \"local\" region", () -> {
      Region<Object, Object> region = createRegion(name);
      region.getAttributesMutator().setCacheLoader(new TestCacheLoader<Object, Object>() {
        @Override
        public Object load2(LoaderHelper<Object, Object> helper) throws CacheLoaderException {
          return value;
        }
      });
    });

    vm1.invoke("Create \"remote\" region", () -> {
      Region<Object, Object> region1 = createRegion(name);
      setLoader(new TestCacheLoader<Object, Object>() {
        @Override
        public Object load2(LoaderHelper<Object, Object> helper) throws CacheLoaderException {
          if (helper.getRegion().getAttributes().getPartitionAttributes() == null) {
            fail("Should not be invoked");
            return null;
          } else {
            return value;
          }
        }
      });
      region1.getAttributesMutator().setCacheLoader(loader());
    });

    vm0.invoke("Get", () -> {
      Region<Object, Object> region = getRootRegion().getSubregion(name);
      assertThat(region.get(key)).isEqualTo(value);
    });
    vm1.invoke("Verify loader not invoked", () -> {
      assertThat(loader().wasInvoked()).isFalse();
    });
  }
Tests that a local loader is preferred to a remote one
geode-dunit/src/main/java/org/apache/geode/cache30/MultiVMRegionTestCase.java