DefaultInitialContext implements Context { @Override public Name composeName(Name name, Name prefix) throws NamingException { String returnedName = composeName(name.toString(), prefix.toString()); return new CompositeName(returnedName); }  @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 testComposeName() throws Exception { DefaultInitialContext context = new DefaultInitialContext(); assertNotNull(context.composeName("name", "")); }
@Test void testComposeName2() throws Exception { DefaultInitialContext context = new DefaultInitialContext(); assertThrows(NamingException.class, () -> context.composeName("name", "kaboom")); }
@Test void testComposeName3() throws Exception { DefaultInitialContext context = new DefaultInitialContext(); assertThrows(NamingException.class, () -> context.composeName("name", null)); }
@Test void testComposeName4() throws Exception { DefaultInitialContext context = new DefaultInitialContext(); assertNotNull(context.composeName(new CompositeName("name"), new CompositeName(""))); }