@Test
  public void testDiskInstantiators() throws CacheException {
    try {
      connect();
      int size = r.entrySet(false).size();
      if (size != 0) {
        fail("expected 0 entries but had " + size);
      }
      ds.getLogWriter().info("adding entry");
      r.put(new Key(1), new Payload(100));
      disconnect();
      // now unregister and make sure we can restore
      InternalInstantiator.unregister(Payload.class, (byte) 22);
      InternalInstantiator.unregister(Key.class, (byte) 21);
      connect();
      size = r.entrySet(false).size();
      if (size != 1) {
        fail("expected 1 entry but had " + size);
      }
      Object value = r.get(new Key(1));
      ds.getLogWriter().info("found entry");
      if (!(value instanceof Payload)) {
        fail("Expected value to be an instance of Payload but it was " + value.getClass());
      }
      disconnect();
    } finally {
      try {
        if (ds == null) {
          connect();
        }
        if (r != null) {
          ds.getLogWriter().info("destroying region");
          r.localDestroyRegion();
        }
      } finally {
        disconnect();
      }
    }
  }
This class makes sure that instantatiors are persisted to disk and can be recovered.
geode-core/src/integrationTest/java/org/apache/geode/DiskInstantiatorsJUnitTest.java