@Test public void saveSetsCorrectSexIfPolicyIsMerge() { doReturn(new SimpleValuePatientData<>(DATA_NAME, SEX_MALE)).when(this.patient).getData(DATA_NAME); this.component.save(this.patient, PatientWritePolicy.MERGE); verify(this.data).setStringValue(INTERNAL_PROPERTY_NAME, SEX_MALE); Mockito.reset(this.xwiki); doReturn(new SimpleValuePatientData<>(DATA_NAME, SEX_FEMALE)).when(this.patient).getData(DATA_NAME); this.component.save(this.patient, PatientWritePolicy.MERGE); verify(this.data).setStringValue(INTERNAL_PROPERTY_NAME, SEX_FEMALE); Mockito.reset(this.xwiki); doReturn(new SimpleValuePatientData<>(DATA_NAME, SEX_OTHER)).when(this.patient).getData(DATA_NAME); this.component.save(this.patient, PatientWritePolicy.MERGE); verify(this.data).setStringValue(INTERNAL_PROPERTY_NAME, SEX_OTHER); Mockito.reset(this.xwiki); doReturn(new SimpleValuePatientData<>(DATA_NAME, SEX_UNKNOWN)).when(this.patient).getData(DATA_NAME); this.component.save(this.patient, PatientWritePolicy.MERGE); verify(this.data).setStringValue(INTERNAL_PROPERTY_NAME, SEX_UNKNOWN); Mockito.reset(this.xwiki); doReturn(new SimpleValuePatientData<String>(DATA_NAME, null)).when(this.patient).getData(DATA_NAME); this.component.save(this.patient, PatientWritePolicy.MERGE); verify(this.data).setStringValue(INTERNAL_PROPERTY_NAME, null); }
@Override public void save(Patient patient) { save(patient, PatientWritePolicy.UPDATE); }
SexController implements PatientDataController<String> { @Override public void save(Patient patient) { save(patient, PatientWritePolicy.UPDATE); } }
SexController implements PatientDataController<String> { @Override public void save(Patient patient) { save(patient, PatientWritePolicy.UPDATE); }  }
SexController implements PatientDataController<String> { @Override public void save(Patient patient) { save(patient, PatientWritePolicy.UPDATE); }  @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(); }
SexController implements PatientDataController<String> { @Override public void save(Patient patient) { save(patient, PatientWritePolicy.UPDATE); }  @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();  }