XmlNamespaceContext implements NamespaceContext { public XmlNamespaceContext add(XmlNamespaceBinding... bindings) { return add($(bindings)); } XmlNamespaceContext(Map<String, String> prefixToUri); static XmlNamespaceContext mk(Map<String, String> prefixToUri); static XmlNamespaceContext mk(XmlNamespaceBinding... bindings); static XmlNamespaceContext mk(String prefix, String namespaceUri); static XmlNamespaceContext mk(List<XmlNamespaceBinding> bindings); static XmlNamespaceContext mk(Stream<XmlNamespaceBinding> bindings); @Override String getNamespaceURI(String prefix); @Override String getPrefix(String uri); @Override Iterator getPrefixes(String uri); List<XmlNamespaceBinding> getBindings(); XmlNamespaceContext add(XmlNamespaceBinding... bindings); XmlNamespaceContext add(XmlNamespaceContext bindings); NamespaceContext merge(final NamespaceContext precedence); static NamespaceContext merge(final NamespaceContext a, final NamespaceContext b);  }
@Test public void testAdd() { final XmlNamespaceContext ctx = XmlNamespaceContext.mk("gnu", "http: final XmlNamespaceContext added = ctx.add( new XmlNamespaceBinding("foo", "http: new XmlNamespaceBinding("bar", "http: testGetNamespaceURI(added); testGetPrefix(added); testGetPrefixes(added, asList("bar")); assertEquals("gnu", added.getPrefix("http: assertNotEquals(ctx, added); }