@Test
  public void testSubcontextInvokingMethodsOnDestroyedContext() throws Exception {
    // Create subcontext and destroy it.
    Context sub = dataSourceContext.createSubcontext("sub4");
    initialContext.destroySubcontext("java:gf/env/datasource/sub4");

    try {
      sub.bind("name", "object");
      fail();
    } catch (NoPermissionException expected) {
    }
    try {
      sub.unbind("name");
      fail();
    } catch (NoPermissionException expected) {
    }
    try {
      sub.createSubcontext("sub5");
      fail();
    } catch (NoPermissionException expected) {
    }
    try {
      sub.destroySubcontext("sub6");
      fail();
    } catch (NoPermissionException expected) {
    }
    try {
      sub.list("");
      fail();
    } catch (NoPermissionException expected) {
    }
    try {
      sub.lookup("name");
      fail();
    } catch (NoPermissionException expected) {
    }
    try {
      sub.composeName("name", "prefix");
      fail();
    } catch (NoPermissionException expected) {
    }
    try {
      NameParserImpl parser = new NameParserImpl();
      sub.composeName(parser.parse("a"), parser.parse("b"));
      fail();
    } catch (NoPermissionException expected) {
    }
  }
Tests inability to invoke methods on destroyed subcontexts.
geode-core/src/test/java/org/apache/geode/internal/jndi/ContextJUnitTest.java