@Test public void writeJSONDoesNothingWhenPatientHasNullDataForIdentifiers() throws ComponentLookupException { when(this.patient.getData(CONTROLLER_NAME)).thenReturn(null); final JSONObject json = new JSONObject(); final Collection<String> selectedFields = new LinkedList<>(); selectedFields.add(IDENTIFIERS_STRING); this.component.writeJSON(this.patient, json, selectedFields); Assert.assertFalse(json.has(CONTROLLER_NAME)); verify(this.patient).getData(CONTROLLER_NAME); }
@Override public void writeJSON(@Nonnull final Patient patient, @Nonnull final JSONObject json, @Nullable final Collection<String> selectedFieldNames) { if (CollectionUtils.isEmpty(selectedFieldNames) || selectedFieldNames.contains(IDENTIFIERS_STRING)) { writeJSON(patient, json); } }
LabeledExternalIdentifiersController implements PatientDataController<Pair<String, String>> { @Override public void writeJSON(@Nonnull final Patient patient, @Nonnull final JSONObject json, @Nullable final Collection<String> selectedFieldNames) { if (CollectionUtils.isEmpty(selectedFieldNames) || selectedFieldNames.contains(IDENTIFIERS_STRING)) { writeJSON(patient, json); } } }
LabeledExternalIdentifiersController implements PatientDataController<Pair<String, String>> { @Override public void writeJSON(@Nonnull final Patient patient, @Nonnull final JSONObject json, @Nullable final Collection<String> selectedFieldNames) { if (CollectionUtils.isEmpty(selectedFieldNames) || selectedFieldNames.contains(IDENTIFIERS_STRING)) { writeJSON(patient, json); } }  }
LabeledExternalIdentifiersController implements PatientDataController<Pair<String, String>> { @Override public void writeJSON(@Nonnull final Patient patient, @Nonnull final JSONObject json, @Nullable final Collection<String> selectedFieldNames) { if (CollectionUtils.isEmpty(selectedFieldNames) || selectedFieldNames.contains(IDENTIFIERS_STRING)) { writeJSON(patient, json); } }  @Override String getName(); @Override PatientData<Pair<String, String>> load(final Patient patient); @Override void writeJSON(@Nonnull final Patient patient, @Nonnull final JSONObject json,
        @Nullable final Collection<String> selectedFieldNames); @Override void writeJSON(@Nonnull final Patient patient, @Nonnull final JSONObject json); @Override PatientData<Pair<String, String>> readJSON(@Nullable final JSONObject json); @Override void save(@Nonnull final Patient patient); @Override void save(@Nonnull final Patient patient, @Nonnull final PatientWritePolicy policy); }
LabeledExternalIdentifiersController implements PatientDataController<Pair<String, String>> { @Override public void writeJSON(@Nonnull final Patient patient, @Nonnull final JSONObject json, @Nullable final Collection<String> selectedFieldNames) { if (CollectionUtils.isEmpty(selectedFieldNames) || selectedFieldNames.contains(IDENTIFIERS_STRING)) { writeJSON(patient, json); } }  @Override String getName(); @Override PatientData<Pair<String, String>> load(final Patient patient); @Override void writeJSON(@Nonnull final Patient patient, @Nonnull final JSONObject json,
        @Nullable final Collection<String> selectedFieldNames); @Override void writeJSON(@Nonnull final Patient patient, @Nonnull final JSONObject json); @Override PatientData<Pair<String, String>> readJSON(@Nullable final JSONObject json); @Override void save(@Nonnull final Patient patient); @Override void save(@Nonnull final Patient patient, @Nonnull final PatientWritePolicy policy);  }