### Question:
NamespaceHandler { static void removeIncludedNamespace(final Map<String, String> nsContext, final String namespace) { final Optional<Map.Entry<String, String>> namespaceToRemove = getAlias(nsContext, namespace); namespaceToRemove.ifPresent(stringStringEntry -> nsContext.remove(stringStringEntry.getKey())); }  static String addIncludedNamespace(final Map<String, String> nsContext,
                                              final String namespace); static Optional<Map.Entry<String, String>> getAlias(final Map<String, String> nsContext,
                                                               final String namespace);  }### Answer:
@Test public void testRemoveIncludedNamespace() { final Map<String, String> nsContext = new HashMap<>(); final String included1 = NamespaceHandler.INCLUDED_NAMESPACE + "1"; final String included2 = NamespaceHandler.INCLUDED_NAMESPACE + "2"; final String included3 = NamespaceHandler.INCLUDED_NAMESPACE + "3"; final String ns1 = "http: final String ns2 = "http: final String ns3 = "http: nsContext.put(included1, ns1); nsContext.put(included2, ns2); nsContext.put(included3, ns3); NamespaceHandler.removeIncludedNamespace(nsContext, ns2); assertEquals(2, nsContext.size()); assertTrue(nsContext.containsKey(included1)); assertTrue(nsContext.containsKey(included3)); }
@Test public void testRemoveIncludedNamespaceNotPresent() { final Map<String, String> nsContext = new HashMap<>(); final String included1 = NamespaceHandler.INCLUDED_NAMESPACE + "1"; final String included2 = NamespaceHandler.INCLUDED_NAMESPACE + "2"; final String ns1 = "http: final String ns2 = "http: final String ns3 = "http: nsContext.put(included1, ns1); nsContext.put(included2, ns2); NamespaceHandler.removeIncludedNamespace(nsContext, ns3); assertEquals(2, nsContext.size()); assertTrue(nsContext.containsKey(included1)); assertTrue(nsContext.containsKey(included2)); }