SimpleNamespaceContext implements NamespaceContext { public Iterator<String> getBoundPrefixes() { Set<String> prefixes = new HashSet<String>(prefixToNamespaceUri.keySet()); prefixes.remove(XMLConstants.DEFAULT_NS_PREFIX); prefixes = Collections.unmodifiableSet(prefixes); return prefixes.iterator(); }  @Override String getNamespaceURI(String prefix); @Override String getPrefix(String namespaceUri); @Override Iterator<String> getPrefixes(String namespaceUri); void setBindings(Map<String, String> bindings); void bindDefaultNamespaceUri(String namespaceUri); void bindNamespaceUri(String prefix, String namespaceUri); void clear(); Iterator<String> getBoundPrefixes(); void removeBinding(String prefix); boolean hasBinding(String prefix);  }
@Test public void testGetBoundPrefixes() throws Exception { Iterator<String> iterator = context.getBoundPrefixes(); Assert.assertNotNull("getPrefixes returns null", iterator); Assert.assertTrue("iterator is empty", iterator.hasNext()); String result = iterator.next(); Assert.assertEquals("Invalid prefix", "prefix", result); Assert.assertFalse("iterator contains multiple values", iterator.hasNext()); }