@Test
public void testGetVersion() throws Exception {

    // Setup:
    VersionedRecord record = versionedRecordFactory.createNew(VERSIONED_RECORD_IRI);
    Version version = versionFactory.createNew(VERSION_IRI);
    record.setVersion(Collections.singleton(version));
    doReturn(record).when(utilsService).getRecord(eq(distributedCatalogId), eq(VERSIONED_RECORD_IRI), eq(versionedRecordFactory), any(RepositoryConnection.class));
    doReturn(version).when(utilsService).getExpectedObject(eq(VERSION_IRI), eq(versionFactory), any(RepositoryConnection.class));
    Optional<Version> result = manager.getVersion(distributedCatalogId, VERSIONED_RECORD_IRI, VERSION_IRI, versionFactory);
    verify(utilsService).getRecord(eq(distributedCatalogId), eq(VERSIONED_RECORD_IRI), eq(versionedRecordFactory), any(RepositoryConnection.class));
    verify(utilsService).getExpectedObject(eq(VERSION_IRI), eq(versionFactory), any(RepositoryConnection.class));
    assertTrue(result.isPresent());
    assertEquals(version, result.get());
}