@Test
public void shouldRegisterOverwriteExistingMappingWhenUsingPreviouslyUsedPrefixWithNewUri() throws Exception {

    String prefix = "foo1";
    String uri1 = "http://example.com";
    String uri2 = "http://acme.com";
    assertThatNamespacePrefixIsNotRegistered(prefix);
    assertThatNamespaceUriIsNotRegistered(uri1);
    assertThatNamespaceUriIsNotRegistered(uri2);
    // Register the first URI with the prefix.
    registry.registerNamespace(prefix, uri1);
    assertThatNamespaceIsRegistered(prefix, uri1);
    // Register the second URI with the same prefix. 'uri1' should no longer be used
    registry.registerNamespace(prefix, uri2);
    assertThatNamespaceIsRegistered(prefix, uri2);
    assertThatNamespaceUriIsNotRegistered(uri1);
}