DefaultInitialContext implements Context { @Override public Object lookup(Name name) throws NamingException { return lookup(name.toString()); }  @Override Object addToEnvironment(String name, Object value); @Override void bind(Name name, Object object); @Override void bind(String name, Object object); @Override void close(); @Override Context createSubcontext(Name name); @Override Context createSubcontext(String name); @Override Name composeName(Name name, Name prefix); @Override String composeName(String name, String prefix); @Override void destroySubcontext(Name name); @Override void destroySubcontext(String name); @Override Hashtable<?, ?> getEnvironment(); @Override String getNameInNamespace(); @Override NameParser getNameParser(Name name); @Override NameParser getNameParser(String name); @Override NamingEnumeration<NameClassPair> list(Name name); @Override NamingEnumeration<NameClassPair> list(String name); @Override NamingEnumeration<Binding> listBindings(Name name); @Override NamingEnumeration<Binding> listBindings(String name); @Override Object lookup(Name name); @Override Object lookup(String name); @Override Object lookupLink(Name name); @Override Object lookupLink(String name); @Override void rebind(Name name, Object object); @Override void rebind(String name, Object obj); @Override Object removeFromEnvironment(String name); @Override void rename(Name oldName, Name newName); @Override void rename(String oldName, String newName); @Override void unbind(Name name); @Override void unbind(String name);  }
@Test void testLookup() throws Exception { DefaultInitialContext context = new DefaultInitialContext(); Name name = new CompositeName("name"); assertThrows(NameNotFoundException.class, () -> context.lookup(name)); }
@Test void testLookup2() throws Exception { DefaultInitialContext context = new DefaultInitialContext(); assertThrows(NameNotFoundException.class, () -> context.lookup("name")); }