@Test
public void updateMdCascade() throws Exception {

    // orphan metadatalink (no link anymore) purge is automatic...
    Element mdAsXml = getMdAsXml();
    AbstractMetadata md = insertMetadataInDb(mdAsXml);
    UrlAnalyzer toTest = createToTest();
    toTest.processMetadata(mdAsXml, md);
    SimpleJpaRepository metadataLinkRepository = new SimpleJpaRepository<MetadataLink, Integer>(MetadataLink.class, entityManager);
    List<MetadataLink> metadataLinkList = metadataLinkRepository.findAll();
    assertEquals(6, metadataLinkList.size());
    Xml.selectElement(mdAsXml, ".//gmd:abstract/gco:CharacterString").setText("http://temporary_ressource_when_network_switch.org");
    toTest.processMetadata(mdAsXml, md);
    metadataLinkList = metadataLinkRepository.findAll();
    assertEquals(5, metadataLinkList.size());
    Set<String> urlFromDb = linkRepository.findAll().stream().map(Link::getUrl).collect(Collectors.toSet());
    assertEquals(7, urlFromDb.size());
}