@Test
  public void testCopies() throws Exception {
    createCache(true);
    try {
      final Object ov = new ModifiableInteger(1);
      final Object v = new ModifiableInteger(2);
      region.put("key", ov);
      region.put("key", v);
      assertTrue("expected listener getOldValue to return copy of ov", oldValue != ov);
      assertEquals(ov, oldValue);
      assertTrue("expected listener getNewValue to return copy of v", newValue != v);
      assertEquals(v, newValue);
      assertTrue("expected get to return copy of v", region.get("key") != v);
      assertEquals(v, region.get("key"));
      Region.Entry re = region.getEntry("key");
      assertTrue("expected Entry.getValue to return copy of v", re.getValue() != v);
      assertEquals(v, re.getValue());
      Collection c = region.values();
      Object[] cArray = c.toArray();
      assertTrue("expected values().toArray() to return copy of v", cArray[0] != v);
      assertEquals(v, cArray[0]);

      assertTrue("expected values().iterator().next() to return copy of v",
          c.iterator().next() != v);
      assertEquals(v, c.iterator().next());
    } finally {
      closeCache();
    }
  }
Tests the functionality of the {@link CopyHelper#copy} method and the builtin copy-on-get Cache
functions.

@since GemFire 4.0
geode-core/src/integrationTest/java/org/apache/geode/CopyJUnitTest.java