@Test public void saveWithReplacePolicyErasesAllControllerDataAndReplacesItWithProvidedData() { final Map<String, String> dataMap = new LinkedHashMap<>(); dataMap.put(PROPERTY_2, PROPERTY_2); dataMap.put(PROPERTY_5, PROPERTY_5); doReturn(new DictionaryPatientData<>(DATA_NAME, dataMap)).when(this.patient).getData(DATA_NAME); this.component.save(this.patient, PatientWritePolicy.REPLACE); verify(this.doc, times(1)).getXObject(Patient.CLASS_REFERENCE, true, this.xcontext); verifyNoMoreInteractions(this.doc); verify(this.data, times(1)).set(PROPERTY_1, null, this.xcontext); verify(this.data, times(1)).set(PROPERTY_2, PROPERTY_2, this.xcontext); verify(this.data, times(1)).set(PROPERTY_3, null, this.xcontext); verify(this.data, times(1)).set(PROPERTY_4, null, this.xcontext); verify(this.data, times(1)).set(PROPERTY_5, PROPERTY_5, this.xcontext); verifyNoMoreInteractions(this.data); }
@Override public void save(Patient patient) { save(patient, PatientWritePolicy.UPDATE); }
AbstractComplexController implements PatientDataController<T> { @Override public void save(Patient patient) { save(patient, PatientWritePolicy.UPDATE); } }
AbstractComplexController implements PatientDataController<T> { @Override public void save(Patient patient) { save(patient, PatientWritePolicy.UPDATE); }  }
AbstractComplexController implements PatientDataController<T> { @Override public void save(Patient patient) { save(patient, PatientWritePolicy.UPDATE); }  @Override @SuppressWarnings("unchecked") PatientData<T> load(Patient patient); @Override void writeJSON(Patient patient, JSONObject json, Collection<String> selectedFieldNames); @Override void writeJSON(Patient patient, JSONObject json); @Override void save(Patient patient); @Override void save(@Nonnull final Patient patient, @Nonnull final PatientWritePolicy policy); @Override PatientData<T> readJSON(JSONObject json); }
AbstractComplexController implements PatientDataController<T> { @Override public void save(Patient patient) { save(patient, PatientWritePolicy.UPDATE); }  @Override @SuppressWarnings("unchecked") PatientData<T> load(Patient patient); @Override void writeJSON(Patient patient, JSONObject json, Collection<String> selectedFieldNames); @Override void writeJSON(Patient patient, JSONObject json); @Override void save(Patient patient); @Override void save(@Nonnull final Patient patient, @Nonnull final PatientWritePolicy policy); @Override PatientData<T> readJSON(JSONObject json);  }