+ Object obj = ctx.lookup(JNDI_NAME);
+ }
+
+ // Name based lookups
+
+ @Test
+ public void testLookupName() throws Exception {
+ StubInitialContextFactory.register();
+
+ InitialContext ctx = new InitialContext();
+ ctx.bind(new CompositeName(JNDI_NAME), "hallo");
+
+ ctx = new InitialContext();
+ Object obj = ctx.lookup(new CompositeName(JNDI_NAME));
+
+ assertEquals("hallo", obj);
+ }
+
+ @Test(expected = NameNotFoundException.class)
+ public void testUnbindName() throws Exception {
+ testLookup();
+ InitialContext ctx = new InitialContext();
+ ctx.unbind(new CompositeName(JNDI_NAME));
+ ctx = new InitialContext();
+ ctx.lookup(new CompositeName(JNDI_NAME));
+ }
+
+ @Test(expected = NameNotFoundException.class)
+ public void testLookupFailsName() throws Exception {
+ StubInitialContextFactory.register();
+
+ InitialContext ctx = new InitialContext();
+ Object obj = ctx.lookup(JNDI_NAME);