@Test
public void getDifferenceWithErrorTest() {

    // Setup:
    doThrow(new MobiException()).when(catalogManager).getDifference(vf.createIRI(COMMIT_IRIS[0]), vf.createIRI(COMMIT_IRIS[0]));
    Response response = target().path("catalogs/" + encode(LOCAL_IRI) + "/records/" + encode(RECORD_IRI)
            + "/branches/" + encode(BRANCH_IRI) + "/difference")
            .queryParam("targetId", BRANCH_IRI).request().get();
    assertEquals(response.getStatus(), 500);
    doThrow(new IllegalStateException()).when(catalogManager).getDifference(vf.createIRI(COMMIT_IRIS[0]), vf.createIRI(COMMIT_IRIS[0]));
    response = target().path("catalogs/" + encode(LOCAL_IRI) + "/records/" + encode(RECORD_IRI)
            + "/branches/" + encode(BRANCH_IRI) + "/difference")
            .queryParam("targetId", BRANCH_IRI).request().get();
    assertEquals(response.getStatus(), 500);
}