@Test public void readJSONDoesNotReturnUnexpectedValue() { JSONObject json = new JSONObject(); json.put(DATA_NAME, "!!!!!"); Assert.assertNull(this.component.readJSON(json)); }
@Override public PatientData<String> readJSON(JSONObject json) { String propertyValue = json.optString(DATA_NAME, null); if (propertyValue != null) { if (ALL_LIFE_STATES.contains(propertyValue)) { return new SimpleValuePatientData<>(DATA_NAME, propertyValue); } } return null; }
LifeStatusController implements PatientDataController<String> { @Override public PatientData<String> readJSON(JSONObject json) { String propertyValue = json.optString(DATA_NAME, null); if (propertyValue != null) { if (ALL_LIFE_STATES.contains(propertyValue)) { return new SimpleValuePatientData<>(DATA_NAME, propertyValue); } } return null; } }
LifeStatusController implements PatientDataController<String> { @Override public PatientData<String> readJSON(JSONObject json) { String propertyValue = json.optString(DATA_NAME, null); if (propertyValue != null) { if (ALL_LIFE_STATES.contains(propertyValue)) { return new SimpleValuePatientData<>(DATA_NAME, propertyValue); } } return null; }  }
LifeStatusController implements PatientDataController<String> { @Override public PatientData<String> readJSON(JSONObject json) { String propertyValue = json.optString(DATA_NAME, null); if (propertyValue != null) { if (ALL_LIFE_STATES.contains(propertyValue)) { return new SimpleValuePatientData<>(DATA_NAME, propertyValue); } } return null; }  @Override PatientData<String> 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<String> readJSON(JSONObject json); @Override String getName(); }
LifeStatusController implements PatientDataController<String> { @Override public PatientData<String> readJSON(JSONObject json) { String propertyValue = json.optString(DATA_NAME, null); if (propertyValue != null) { if (ALL_LIFE_STATES.contains(propertyValue)) { return new SimpleValuePatientData<>(DATA_NAME, propertyValue); } } return null; }  @Override PatientData<String> 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<String> readJSON(JSONObject json); @Override String getName();  }