@Test
public void testGetCommitThatDoesNotBelongToBranch() {

    // Setup:
    Resource headId = VALUE_FACTORY.createIRI(COMMITS + "test4a");
    Branch branch = branchFactory.createNew(MASTER_BRANCH_IRI);
    doReturn(headId).when(utilsService).getHeadCommitIRI(branch);
    doReturn(branch).when(utilsService).getExpectedObject(eq(MASTER_BRANCH_IRI), eq(branchFactory), any(RepositoryConnection.class));
    doReturn(false).when(utilsService).commitInBranch(eq(MASTER_BRANCH_IRI), eq(COMMIT_IRI), any(RepositoryConnection.class));
    Optional<Commit> result = manager.getCommit(distributedCatalogId, VERSIONED_RDF_RECORD_IRI, MASTER_BRANCH_IRI, COMMIT_IRI);
    verify(utilsService).validateBranch(eq(distributedCatalogId), eq(VERSIONED_RDF_RECORD_IRI), eq(MASTER_BRANCH_IRI), any(RepositoryConnection.class));
    verify(utilsService, times(0)).getExpectedObject(eq(COMMIT_IRI), eq(commitFactory), any(RepositoryConnection.class));
    assertFalse(result.isPresent());
}