@Test public void updatePatientNotFoundNewPatientSpecifiesIdInJson() throws QueryException { Query query = mock(DefaultQuery.class); when(this.repository.getByName(EID)).thenReturn(null); when(this.qm.createQuery(Matchers.anyString(), Matchers.anyString())).thenReturn(query); when(query.execute()).thenReturn(new ArrayList<>()); Response response = this.component.updatePatient("{\"external_id\":\"abc\"}", EID, UPDATE); verify(this.logger).debug("No patient record with external ID [{}] exists yet", EID); verify(this.logger).debug("Creating patient record with external ID [{}]", EID); assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus()); ArgumentCaptor<JSONObject> json = ArgumentCaptor.forClass(JSONObject.class); verify(this.patient).updateFromJSON(json.capture()); assertEquals("abc", json.getValue().optString(EXTERNAL_ID)); assertEquals(1, json.getValue().length()); }
@Override public Response updatePatient(final String json, final String eid, final String policy) { final PatientWritePolicy policyType = PatientWritePolicy.fromString(policy); return updatePatient(json, eid, policyType); }
DefaultPatientByExternalIdResourceImpl extends XWikiResource implements PatientByExternalIdResource { @Override public Response updatePatient(final String json, final String eid, final String policy) { final PatientWritePolicy policyType = PatientWritePolicy.fromString(policy); return updatePatient(json, eid, policyType); } }
DefaultPatientByExternalIdResourceImpl extends XWikiResource implements PatientByExternalIdResource { @Override public Response updatePatient(final String json, final String eid, final String policy) { final PatientWritePolicy policyType = PatientWritePolicy.fromString(policy); return updatePatient(json, eid, policyType); }  }
DefaultPatientByExternalIdResourceImpl extends XWikiResource implements PatientByExternalIdResource { @Override public Response updatePatient(final String json, final String eid, final String policy) { final PatientWritePolicy policyType = PatientWritePolicy.fromString(policy); return updatePatient(json, eid, policyType); }  @Override Response getPatient(String eid); @Override Response updatePatient(final String json, final String eid, final String policy); @Override Response patchPatient(final String json, final String eid); @Override Response deletePatient(String eid); }
DefaultPatientByExternalIdResourceImpl extends XWikiResource implements PatientByExternalIdResource { @Override public Response updatePatient(final String json, final String eid, final String policy) { final PatientWritePolicy policyType = PatientWritePolicy.fromString(policy); return updatePatient(json, eid, policyType); }  @Override Response getPatient(String eid); @Override Response updatePatient(final String json, final String eid, final String policy); @Override Response patchPatient(final String json, final String eid); @Override Response deletePatient(String eid);  }