Exemplo n.º 1
0
  public void testUnsupportedMethods() throws Exception {

    replay();

    final DelegatingContext delegatingContext =
        new DelegatingContext(keyedObjectPoolMock, contextMock, DirContextType.READ_ONLY);

    try {
      delegatingContext.addToEnvironment(null, null);
      fail(
          "DelegatingContext.addToEnvironment Should have thrown an UnsupportedOperationException");
    } catch (UnsupportedOperationException uoe) {
      // Expected
    }
    try {
      delegatingContext.createSubcontext((Name) null);
      fail(
          "DelegatingContext.createSubcontext Should have thrown an UnsupportedOperationException");
    } catch (UnsupportedOperationException uoe) {
      // Expected
    }
    try {
      delegatingContext.createSubcontext((String) null);
      fail(
          "DelegatingContext.createSubcontext Should have thrown an UnsupportedOperationException");
    } catch (UnsupportedOperationException uoe) {
      // Expected
    }
    try {
      delegatingContext.destroySubcontext((Name) null);
      fail(
          "DelegatingContext.destroySubcontext Should have thrown an UnsupportedOperationException");
    } catch (UnsupportedOperationException uoe) {
      // Expected
    }
    try {
      delegatingContext.destroySubcontext((String) null);
      fail(
          "DelegatingContext.destroySubcontext Should have thrown an UnsupportedOperationException");
    } catch (UnsupportedOperationException uoe) {
      // Expected
    }
    try {
      delegatingContext.removeFromEnvironment(null);
      fail(
          "DelegatingContext.removeFromEnvironment Should have thrown an UnsupportedOperationException");
    } catch (UnsupportedOperationException uoe) {
      // Expected
    }
    verify();
  }