@Test public void writeJSONWithControllerNameAsSelectedFieldsAddsReports() throws ComponentLookupException { when(this.patient.getData(CONTROLLER_NAME)) .thenReturn(new IndexedPatientData<>(CONTROLLER_NAME, Arrays.asList(this.a1, this.a2))); JSONObject json = new JSONObject(); this.mocker.getComponentUnderTest().writeJSON(this.patient, json, Collections.singletonList(CONTROLLER_NAME)); Assert.assertTrue(json.has(DATA_NAME)); JSONArray result = json.getJSONArray(DATA_NAME); Assert.assertEquals(2, result.length()); Assert.assertSame(this.json1full, result.getJSONObject(0)); Assert.assertSame(this.json2full, result.getJSONObject(1)); }
@Override public void writeJSON(Patient patient, JSONObject json) { writeJSON(patient, json, null); }
MedicalReportsController implements PatientDataController<Attachment> { @Override public void writeJSON(Patient patient, JSONObject json) { writeJSON(patient, json, null); } }
MedicalReportsController implements PatientDataController<Attachment> { @Override public void writeJSON(Patient patient, JSONObject json) { writeJSON(patient, json, null); }  }
MedicalReportsController implements PatientDataController<Attachment> { @Override public void writeJSON(Patient patient, JSONObject json) { writeJSON(patient, json, null); }  @Override PatientData<Attachment> load(Patient patient); @Override void save(Patient patient); @Override void save(@Nonnull final Patient patient, @Nonnull final PatientWritePolicy policy); @Override void writeJSON(Patient patient, JSONObject json); @Override void writeJSON(Patient patient, JSONObject json, Collection<String> selectedFieldNames); @Override PatientData<Attachment> readJSON(JSONObject json); @Override String getName(); }
MedicalReportsController implements PatientDataController<Attachment> { @Override public void writeJSON(Patient patient, JSONObject json) { writeJSON(patient, json, null); }  @Override PatientData<Attachment> load(Patient patient); @Override void save(Patient patient); @Override void save(@Nonnull final Patient patient, @Nonnull final PatientWritePolicy policy); @Override void writeJSON(Patient patient, JSONObject json); @Override void writeJSON(Patient patient, JSONObject json, Collection<String> selectedFieldNames); @Override PatientData<Attachment> readJSON(JSONObject json); @Override String getName();  }