@Test public void updatePatientCatchesExceptions() { JSONObject json = new JSONObject(); json.put("id", PATIENT_ID); doReturn(PATIENT_ID).when(this.patient).getId(); doThrow(Exception.class).when(this.patient).updateFromJSON(any(JSONObject.class), any(PatientWritePolicy.class)); WebApplicationException ex = null; try { this.patientResource.updatePatient(json.toString(), PATIENT_ID, UPDATE); } catch (WebApplicationException temp) { ex = temp; } Assert.assertNotNull("updatePatient did not throw a WebApplicationException as expected " + "when catching an Exception from Patient.updateFromJSON", ex); Assert.assertEquals(Status.INTERNAL_SERVER_ERROR.getStatusCode(), ex.getResponse().getStatus()); verify(this.logger).warn("Failed to update patient [{}] from JSON: {}. Source JSON was: {}", this.patient.getId(), ex.getMessage(), json.toString()); }
@Override public Response updatePatient(String json, String id, String policy) { final PatientWritePolicy policyType = PatientWritePolicy.fromString(policy); return updatePatient(json, id, policyType); }
DefaultPatientResourceImpl extends XWikiResource implements PatientResource { @Override public Response updatePatient(String json, String id, String policy) { final PatientWritePolicy policyType = PatientWritePolicy.fromString(policy); return updatePatient(json, id, policyType); } }
DefaultPatientResourceImpl extends XWikiResource implements PatientResource { @Override public Response updatePatient(String json, String id, String policy) { final PatientWritePolicy policyType = PatientWritePolicy.fromString(policy); return updatePatient(json, id, policyType); }  }
DefaultPatientResourceImpl extends XWikiResource implements PatientResource { @Override public Response updatePatient(String json, String id, String policy) { final PatientWritePolicy policyType = PatientWritePolicy.fromString(policy); return updatePatient(json, id, policyType); }  @Override Response getPatient(String id); @Override Response updatePatient(String json, String id, String policy); @Override Response patchPatient(final String json, final String id); @Override Response deletePatient(String id); }
DefaultPatientResourceImpl extends XWikiResource implements PatientResource { @Override public Response updatePatient(String json, String id, String policy) { final PatientWritePolicy policyType = PatientWritePolicy.fromString(policy); return updatePatient(json, id, policyType); }  @Override Response getPatient(String id); @Override Response updatePatient(String json, String id, String policy); @Override Response patchPatient(final String json, final String id); @Override Response deletePatient(String id);  }