@Test
public void removeVersionWithResourceTest() throws Exception {

    // Setup:
    Version version = versionFactory.createNew(LATEST_VERSION_IRI);
    version.setVersionedDistribution(Collections.singleton(distributionFactory.createNew(DISTRIBUTION_IRI)));
    try (RepositoryConnection conn = repo.getConnection()) {
        assertTrue(conn.getStatements(VERSIONED_RECORD_IRI, LATEST_VERSION_CATALOG_IRI, LATEST_VERSION_IRI, VERSIONED_RECORD_IRI).hasNext());
        assertTrue(conn.getStatements(VERSIONED_RECORD_IRI, VERSION_CATALOG_IRI, LATEST_VERSION_IRI, VERSIONED_RECORD_IRI).hasNext());
        assertTrue(conn.getStatements(VERSIONED_RECORD_IRI, VERSION_CATALOG_IRI, VERSION_IRI, VERSIONED_RECORD_IRI).hasNext());
        service.removeVersion(VERSIONED_RECORD_IRI, version.getResource(), conn);
        assertTrue(conn.getStatements(VERSIONED_RECORD_IRI, LATEST_VERSION_CATALOG_IRI, VERSION_IRI, VERSIONED_RECORD_IRI).hasNext());
        assertTrue(conn.getStatements(VERSIONED_RECORD_IRI, VERSION_CATALOG_IRI, VERSION_IRI, VERSIONED_RECORD_IRI).hasNext());
        assertFalse(conn.getStatements(VERSIONED_RECORD_IRI, LATEST_VERSION_CATALOG_IRI, LATEST_VERSION_IRI, VERSIONED_RECORD_IRI).hasNext());
        assertFalse(conn.getStatements(VERSIONED_RECORD_IRI, VERSION_CATALOG_IRI, LATEST_VERSION_IRI, VERSIONED_RECORD_IRI).hasNext());
    }
}