namingStore.bind(new CompositeName("testContext/test"), "test");
final NamingEnumeration<Binding> results = namingContext.listBindings(new CompositeName());
final Set<String> expected = new HashSet<String>(Arrays.asList("test", "testTwo", "testThree", "testContext"));
while (results.hasMore()) {
final Binding result = results.next();
final String resultName = result.getName();
if ("test".equals(resultName)) {
assertEquals(Object.class.getName(), result.getClassName());
assertEquals(object, result.getObject());
} else if ("testTwo".equals(resultName)) {
assertEquals(Object.class.getName(), result.getClassName());
assertEquals(objectTwo, result.getObject());
} else if ("testThree".equals(resultName)) {
assertEquals(Object.class.getName(), result.getClassName());
assertEquals(objectThree, result.getObject());
} else if ("testContext".equals(resultName)) {
assertEquals(Context.class.getName(), result.getClassName());
} else {
fail("Unknown result name: " + resultName);
}
expected.remove(resultName);
}