NamespaceContextMap implements NamespaceContext { @Override public final String getPrefix(final String namespaceURI) { final List<String> prefixes = uriMap.get(namespaceURI); if ((prefixes == null) || (prefixes.size() < 1)) { return null; } return prefixes.get(0); } NamespaceContextMap(@Nullable final String... values); @Override final String getNamespaceURI(final String prefix); @Override final String getPrefix(final String namespaceURI); @Override final Iterator<String> getPrefixes(final String namespaceURI);  }
@Test public void testGetPrefix() { assertThat(testee.getPrefix("http: assertThat(testee.getPrefix("http: assertThat(testee.getPrefix("ghi")).isNull(); assertThat(testee.getPrefix(XMLConstants.XML_NS_URI)).isEqualTo(XMLConstants.XML_NS_PREFIX); assertThat(testee.getPrefix(XMLConstants.XMLNS_ATTRIBUTE_NS_URI )).isEqualTo(XMLConstants.XMLNS_ATTRIBUTE); }