@Test
public void testAddVersionedDistribution() throws Exception {

    // Setup:
    Version version = versionFactory.createNew(VERSION_IRI);
    Distribution dist = distributionFactory.createNew(NEW_IRI);
    doReturn(version).when(utilsService).getVersion(eq(distributedCatalogId), eq(VERSIONED_RECORD_IRI), eq(VERSION_IRI), eq(versionFactory), any(RepositoryConnection.class));
    manager.addVersionedDistribution(distributedCatalogId, VERSIONED_RECORD_IRI, VERSION_IRI, dist);
    verify(utilsService).getVersion(eq(distributedCatalogId), eq(VERSIONED_RECORD_IRI), eq(VERSION_IRI), eq(versionFactory), any(RepositoryConnection.class));
    verify(utilsService).updateObject(eq(version), any(RepositoryConnection.class));
    verify(utilsService).addObject(eq(dist), any(RepositoryConnection.class));
    assertEquals(1, version.getVersionedDistribution_resource().size());
}