### Question:
JndiFacade extends MBeanSupport implements JndiFacadeMXBean { @Override public JndiDTO[] list(final String name) throws NamingException { return execute(new ContextCallback<JndiDTO[]>() { @Override public JndiDTO[] doInJndi(Context context) throws NamingException { NamingEnumeration<NameClassPair> namingEnum=null; try { namingEnum=context.list(fixName(name)); String prefix=name==null||name.isEmpty()?"":name+"/"; List<JndiDTO> namingDatas=new ArrayList<JndiDTO>(); while(namingEnum.hasMore()) { NameClassPair nameClassPair=namingEnum.next(); String simpleName=nameClassPair.getName(); String fullName=prefix+simpleName; if (nameClassPair instanceof Binding) { Binding binding=(Binding) nameClassPair; namingDatas.add(createData(context, fullName, simpleName, nameClassPair.getClassName(), binding.getObject())); } else { namingDatas.add(createData(context, fullName, simpleName, nameClassPair.getClassName(), null)); } } return namingDatas.toArray(new JndiDTO[namingDatas.size()]); } finally { if (namingEnum!=null) { namingEnum.close(); } } } }); } JndiFacade(); final void addDataTypes(Collection<Class>  aDataTypes); final void addDataTypes(Class... aDataTypes); final void addDataTypes(String... aDataTypeNames); @Override JndiDTO[] list(final String name); @Override JndiDTO lookup(final String name); @Override JndiDTO[] getData(); @Override String getContextName(); void setContextName(String contextName); Hashtable<String, ?> getEnvironment(); void setEnvironment(Hashtable<String, ?> environment);  }### Answer:
@Test public void testList() throws NamingException { assertEquals(3, jndiFacade.list(null).length); assertEquals(3, jndiFacade.list("").length); final JndiDTO[] namingDatas = jndiFacade.list("subcontext"); assertEquals(1, namingDatas.length); assertEquals("subcontext/boolean", namingDatas[0].getFullName()); assertEquals("boolean", namingDatas[0].getSimpleName()); assertEquals("java.lang.Boolean", namingDatas[0].getTypeNames()[0]); }