@Test
public void testUpdateHead() throws Exception {

    // Setup:
    Branch branch = branchFactory.createNew(BRANCH_IRI);
    doReturn(branch).when(utilsService).getBranch(eq(distributedCatalogId), eq(VERSIONED_RDF_RECORD_IRI), eq(BRANCH_IRI), eq(branchFactory), any(RepositoryConnection.class));
    manager.updateHead(distributedCatalogId, VERSIONED_RDF_RECORD_IRI, BRANCH_IRI, COMMIT_IRI);
    verify(utilsService).getBranch(eq(distributedCatalogId), eq(VERSIONED_RDF_RECORD_IRI), eq(BRANCH_IRI), eq(branchFactory), any(RepositoryConnection.class));
    verify(utilsService).validateResource(eq(COMMIT_IRI), eq(commitFactory.getTypeIRI()), any(RepositoryConnection.class));
    verify(utilsService).updateObject(eq(branch), any(RepositoryConnection.class));
    assertTrue(branch.getHead_resource().isPresent());
    assertEquals(COMMIT_IRI, branch.getHead_resource().get());
}