SimpleNamespaceContext implements NamespaceContext { public boolean hasBinding(String prefix) { return prefixToNamespaceUri.containsKey(prefix); }  @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 testHasBinding() { context.clear(); String prefix = "prefix"; Assert.assertFalse("Context has binding", context.hasBinding(prefix)); String namespaceUri = "namespaceUri"; context.bindNamespaceUri(prefix, namespaceUri); Assert.assertTrue("Context has no binding", context.hasBinding(prefix)); }