@Test
public void testRemoveVersion() throws Exception {

    // Setup:
    IRI versionIRI = VALUE_FACTORY.createIRI(VersionedRecord.version_IRI);
    IRI latestIRI = VALUE_FACTORY.createIRI(VersionedRecord.latestVersion_IRI);
    Version version = versionFactory.createNew(LATEST_VERSION_IRI);
    version.setVersionedDistribution(Collections.singleton(distributionFactory.createNew(DISTRIBUTION_IRI)));
    doReturn(version).when(utilsService).getVersion(eq(distributedCatalogId), eq(VERSIONED_RECORD_IRI), eq(LATEST_VERSION_IRI), eq(versionFactory), any(RepositoryConnection.class));
    try (RepositoryConnection conn = repo.getConnection()) {
        assertTrue(conn.getStatements(VERSIONED_RECORD_IRI, latestIRI, LATEST_VERSION_IRI, VERSIONED_RECORD_IRI).hasNext());
        assertTrue(conn.getStatements(VERSIONED_RECORD_IRI, versionIRI, LATEST_VERSION_IRI, VERSIONED_RECORD_IRI).hasNext());
        manager.removeVersion(distributedCatalogId, VERSIONED_RECORD_IRI, LATEST_VERSION_IRI);
        verify(utilsService).getVersion(eq(distributedCatalogId), eq(VERSIONED_RECORD_IRI), eq(LATEST_VERSION_IRI), eq(versionFactory), any(RepositoryConnection.class));
        verify(utilsService).removeVersion(eq(VERSIONED_RECORD_IRI), eq(version), any(RepositoryConnection.class));
    }
}