@Test
  public void testBadRegionAccess() throws CacheException {
    String key = getUniqueName();
    Region<Object, Object> region = createRegion(key);

    assertNull(region.get(key));
    assertNull(region.getEntry(key));

    Integer value = 42;
    region.create(key, value);

    try {
      // partitioned regions are logging the EntryExistsException, so emit
      // a directive to ignore it
      logger.info("<ExpectedException action=add>"
          + "org.apache.geode.cache.EntryExistsException" + "</ExpectedException>");
      region.create(key, value);
      fail("Should have thrown an EntryExistsException");

    } catch (EntryExistsException ex) {
      // okay...
    } finally {
      logger.info("<ExpectedException action=remove>"
          + "org.apache.geode.cache.EntryExistsException" + "</ExpectedException>");
    }
  }
Tests that creating or getting entries at an improper time throws exceptions.

@see Region#get
@see Region#getEntry
@see Region#create
geode-dunit/src/main/java/org/apache/geode/cache30/RegionTestCase.java