@Test public void testRebind_1() throws Exception { try { ic.lookup("/nosuchsubcontext"); ProxyAssertSupport.fail("the name is not supposed to be there"); } catch (NameNotFoundException e) { // OK } JNDIUtil.rebind(ic, "/nosuchsubcontext/sub1/sub2/sub3/name", new Integer(7)); ProxyAssertSupport.assertEquals( 7, ((Integer) ic.lookup("/nosuchsubcontext/sub1/sub2/sub3/name")).intValue()); }
@Test public void testRebind_3() throws Exception { try { ic.lookup("doesnotexistyet"); ProxyAssertSupport.fail("the name is not supposed to be there"); } catch (NameNotFoundException e) { // OK } JNDIUtil.rebind(ic, "doesnotexistyet", new Integer(9)); ProxyAssertSupport.assertEquals(9, ((Integer) ic.lookup("/doesnotexistyet")).intValue()); ic.unbind("doesnotexistyet"); }