@Test
  public void testImmutable() throws Exception {
    createCache(true);
    try {
      // Integer is immutable so copies should not be made
      final Object ov = 6;
      final Object v = 7;
      region.put("key", ov);
      region.put("key", v);
      assertSame(ov, oldValue);
      assertSame(v, newValue);
      assertSame(v, region.get("key"));
      Region.Entry re = region.getEntry("key");
      assertSame(v, re.getValue());
      Collection c = region.values();
      Object[] cArray = c.toArray();
      assertSame(v, cArray[0]);

      assertSame(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