@Test
public void testRemoveUnversionedRecord() throws Exception {

    // Setup:
    UnversionedRecord record = unversionedRecordFactory.createNew(UNVERSIONED_RECORD_IRI);
    record.setCatalog(catalogFactory.createNew(distributedCatalogId));
    Distribution dist = distributionFactory.createNew(DISTRIBUTION_IRI);
    record.setUnversionedDistribution(Collections.singleton(dist));
    doReturn(Optional.of(record)).when(utilsService).optObject(eq(UNVERSIONED_RECORD_IRI), eq(unversionedRecordFactory), any(RepositoryConnection.class));
    Record result = manager.removeRecord(distributedCatalogId, UNVERSIONED_RECORD_IRI, unversionedRecordFactory);
    assertEquals(record, result);
    record.getUnversionedDistribution_resource().forEach(resource -> verify(utilsService).remove(eq(resource), any(RepositoryConnection.class)));
    verify(utilsService).removeObject(any(UnversionedRecord.class), any(RepositoryConnection.class));
}