public void testAllMethodsOpened() throws Exception { contextControl = MockControl.createNiceControl(Context.class); contextMock = (Context) contextControl.getMock(); replay(); final DelegatingContext delegatingContext = new DelegatingContext(keyedObjectPoolMock, contextMock, DirContextType.READ_ONLY); delegatingContext.bind((Name) null, null); delegatingContext.bind((String) null, null); delegatingContext.composeName((Name) null, (Name) null); delegatingContext.composeName((String) null, (String) null); delegatingContext.getEnvironment(); delegatingContext.getNameInNamespace(); delegatingContext.getNameParser((Name) null); delegatingContext.getNameParser((String) null); delegatingContext.list((Name) null); delegatingContext.list((String) null); delegatingContext.listBindings((Name) null); delegatingContext.listBindings((String) null); delegatingContext.lookup((Name) null); delegatingContext.lookup((String) null); delegatingContext.lookupLink((Name) null); delegatingContext.lookupLink((String) null); delegatingContext.rebind((Name) null, null); delegatingContext.rebind((String) null, null); delegatingContext.rename((Name) null, (Name) null); delegatingContext.rename((String) null, (String) null); delegatingContext.unbind((Name) null); delegatingContext.unbind((String) null); verify(); }
public void testAllMethodsClosed() throws Exception { keyedObjectPoolMock.returnObject(DirContextType.READ_ONLY, contextMock); keyedObjectPoolControl.setVoidCallable(1); replay(); final DelegatingContext delegatingContext = new DelegatingContext(keyedObjectPoolMock, contextMock, DirContextType.READ_ONLY); delegatingContext.close(); try { delegatingContext.bind((Name) null, null); fail("DelegatingContext.bind should have thrown a NamingException"); } catch (NamingException ne) { // Expected } try { delegatingContext.bind((String) null, null); fail("DelegatingContext.bind should have thrown a NamingException"); } catch (NamingException ne) { // Expected } try { delegatingContext.composeName((Name) null, (Name) null); fail("DelegatingContext.composeName should have thrown a NamingException"); } catch (NamingException ne) { // Expected } try { delegatingContext.composeName((String) null, (String) null); fail("DelegatingContext.composeName should have thrown a NamingException"); } catch (NamingException ne) { // Expected } try { delegatingContext.getEnvironment(); fail("DelegatingContext.getEnvironment should have thrown a NamingException"); } catch (NamingException ne) { // Expected } try { delegatingContext.getNameInNamespace(); fail("DelegatingContext.getNameInNamespace should have thrown a NamingException"); } catch (NamingException ne) { // Expected } try { delegatingContext.getNameParser((Name) null); fail("DelegatingContext.getNameParser should have thrown a NamingException"); } catch (NamingException ne) { // Expected } try { delegatingContext.getNameParser((String) null); fail("DelegatingContext.getNameParser should have thrown a NamingException"); } catch (NamingException ne) { // Expected } try { delegatingContext.list((Name) null); fail("DelegatingContext.list should have thrown a NamingException"); } catch (NamingException ne) { // Expected } try { delegatingContext.list((String) null); fail("DelegatingContext.list should have thrown a NamingException"); } catch (NamingException ne) { // Expected } try { delegatingContext.listBindings((Name) null); fail("DelegatingContext.listBindings should have thrown a NamingException"); } catch (NamingException ne) { // Expected } try { delegatingContext.listBindings((String) null); fail("DelegatingContext.listBindings should have thrown a NamingException"); } catch (NamingException ne) { // Expected } try { delegatingContext.lookup((Name) null); fail("DelegatingContext.lookup should have thrown a NamingException"); } catch (NamingException ne) { // Expected } try { delegatingContext.lookup((String) null); fail("DelegatingContext.lookup should have thrown a NamingException"); } catch (NamingException ne) { // Expected } try { delegatingContext.lookupLink((Name) null); fail("DelegatingContext.lookupLink should have thrown a NamingException"); } catch (NamingException ne) { // Expected } try { delegatingContext.lookupLink((String) null); fail("DelegatingContext.lookupLink should have thrown a NamingException"); } catch (NamingException ne) { // Expected } try { delegatingContext.rebind((Name) null, null); fail("DelegatingContext.rebind should have thrown a NamingException"); } catch (NamingException ne) { // Expected } try { delegatingContext.rebind((String) null, null); fail("DelegatingContext.rebind should have thrown a NamingException"); } catch (NamingException ne) { // Expected } try { delegatingContext.rename((Name) null, (Name) null); fail("DelegatingContext.rename should have thrown a NamingException"); } catch (NamingException ne) { // Expected } try { delegatingContext.rename((String) null, (String) null); fail("DelegatingContext.rename should have thrown a NamingException"); } catch (NamingException ne) { // Expected } try { delegatingContext.unbind((Name) null); fail("DelegatingContext.unbind should have thrown a NamingException"); } catch (NamingException ne) { // Expected } try { delegatingContext.unbind((String) null); fail("DelegatingContext.unbind should have thrown a NamingException"); } catch (NamingException ne) { // Expected } verify(); }