Source:
public void patchMultipleOperationsWithFailure() throws Exception { context.turnOffAuthorisationSystem(); EPerson ePerson = EPersonBuilder.createEPerson(context) .withNameInMetadata("John", "Doe") .withEmail("Johndoe@example.com") .build(); context.restoreAuthSystemState(); String token = getAuthToken(admin.getEmail(), password); context.restoreAuthSystemState(); List<Operation> ops = new ArrayList<Operation>(); ReplaceOperation replaceOperation0 = new ReplaceOperation("/canLogin", true); ops.add(replaceOperation0); String patchBody = getPatchContent(ops); getClient(token).perform(patch("/api/eperson/epersons/" + ePerson.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isOk()) .andExpect(jsonPath("$.canLogIn", Matchers.is(true))); ReplaceOperation replaceOperation1 = new ReplaceOperation("/canLogin", false); ops.add(replaceOperation1); ReplaceOperation replaceOperation2 = new ReplaceOperation("/certificate", true); ops.add(replaceOperation2); ReplaceOperation replaceOperation3 = new ReplaceOperation("/nonexistentPath", "somevalue"); ops.add(replaceOperation3); ReplaceOperation replaceOperation4 = new ReplaceOperation("/certificate", false); ops.add(replaceOperation4); patchBody = getPatchContent(ops); getClient(token).perform(patch("/api/eperson/epersons/" + ePerson.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isBadRequest()); getClient(token).perform(get("/api/eperson/epersons/" + ePerson.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$.canLogIn", Matchers.is(true))); }

Target:
public void patchMultipleOperationsWithFailure() throws Exception { context.turnOffAuthorisationSystem(); EPerson ePerson = EPersonBuilder.createEPerson(context) .withNameInMetadata("John", "Doe") .withEmail("Johndoe@example.com") .build(); context.restoreAuthSystemState(); String token = getAuthToken(admin.getEmail(), password); List<Operation> ops = new ArrayList<Operation>(); ReplaceOperation replaceOperation0 = new ReplaceOperation("/canLogin", true); ops.add(replaceOperation0); String patchBody = getPatchContent(ops); getClient(token).perform(patch("/api/eperson/epersons/" + ePerson.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isOk()) .andExpect(jsonPath("$.canLogIn", Matchers.is(true))); ReplaceOperation replaceOperation1 = new ReplaceOperation("/canLogin", false); ops.add(replaceOperation1); ReplaceOperation replaceOperation2 = new ReplaceOperation("/certificate", true); ops.add(replaceOperation2); ReplaceOperation replaceOperation3 = new ReplaceOperation("/nonexistentPath", "somevalue"); ops.add(replaceOperation3); ReplaceOperation replaceOperation4 = new ReplaceOperation("/certificate", false); ops.add(replaceOperation4); patchBody = getPatchContent(ops); getClient(token).perform(patch("/api/eperson/epersons/" + ePerson.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isBadRequest()); getClient(token).perform(get("/api/eperson/epersons/" + ePerson.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$.canLogIn", Matchers.is(true))); }