Source:
<code>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); <START> context.restoreAuthSystemState(); <END> 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))); }</code><technical_language>accidentally context.restoreAuthSystemState() calls in this method now. This removed</technical_language>

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))); }