@Test
  public void copyAndReleaseWithDeserializedReturnsValueOfOriginal() {
    allocateOffHeapDeserialized();
    assertTrue(storedObject.retain());
    Object returnObject = OffHeapHelper.copyAndReleaseIfNeeded(storedObject, null);
    assertThat(returnObject, is(equalTo(deserializedRegionEntryValue)));
  }
Extracted from JUnit setUp() to reduce test overhead for cases where offheap memory isn't
needed.
geode-core/src/test/java/org/apache/geode/internal/offheap/OffHeapHelperJUnitTest.java