@Test
public void testRemoveRecord() throws Exception {

    // Setup:
    Record record = unversionedRecordFactory.createNew(RECORD_IRI);
    record.setCatalog(catalogFactory.createNew(distributedCatalogId));
    doReturn(Optional.of(record)).when(utilsService).optObject(eq(RECORD_IRI), eq(recordFactory), any(RepositoryConnection.class));
    Record result = manager.removeRecord(distributedCatalogId, RECORD_IRI, recordFactory);
    assertEquals(record, result);
    verify(utilsService).optObject(eq(RECORD_IRI), eq(recordFactory), any(RepositoryConnection.class));
    verify(utilsService).optObject(eq(RECORD_IRI), eq(recordFactory), any(RepositoryConnection.class));
    verify(utilsService).removeObject(any(Record.class), any(RepositoryConnection.class));
}