@SuppressWarnings( "deprecation" )
@Test
public void shouldBeAbleToExecuteXPathQueryWithNewlyRegisteredNamespace() throws RepositoryException {

    NamespaceRegistry namespaceRegistry = session.getWorkspace().getNamespaceRegistry();
    namespaceRegistry.registerNamespace("newPrefix", "newUri");
    try {
        // We don't have any elements that use this yet, but let's at least verify that it can execute.
        Query query = session.getWorkspace().getQueryManager()
                             .createQuery("//*[@newPrefix:someColumn = 'someValue']", Query.XPATH);
        query.execute();
    } finally {
        namespaceRegistry.unregisterNamespace("newPrefix");
    }
}