@Test public void saveUpdatesAttachmentsAndMedicalRecordsFieldWhenPolicyIsReplace() throws ComponentLookupException, IOException, XWikiException { this.mocker.getComponentUnderTest().save(this.patient, PatientWritePolicy.REPLACE); verify(this.doc).removeXObjects(AdditionalImagesController.CLASS_REFERENCE); verify(this.doc, times(2)).newXObject(AdditionalImagesController.CLASS_REFERENCE, this.context); verify(this.xattachment1).setFilesize(4); verify(this.xattachment1).setDate(this.date1); verify(this.xattachment1).setAuthorReference(this.author1); verify(this.xattachment1).setContent(this.attachment1.getContent()); verify(this.image1).setStringValue(FILE_FIELD_NAME, "a1.png"); verify(this.image1).setLargeStringValue(COMMENTS_FIELD_NAME, "Comment 1"); verify(this.image1).setIntValue(PRINT_FIELD_NAME, 1); verify(this.xattachment2).setFilesize(3); verify(this.xattachment2).setDate(this.date2); verify(this.xattachment2).setAuthorReference(this.author2); verify(this.xattachment2).setContent(this.attachment2.getContent()); verify(this.image2).setStringValue(FILE_FIELD_NAME, "a2.png"); verify(this.image2).setLargeStringValue(Matchers.eq(COMMENTS_FIELD_NAME), Matchers.isNull(String.class)); verify(this.image2, never()).setIntValue(Matchers.eq(PRINT_FIELD_NAME), Matchers.anyInt()); }
@Override public void save(@Nonnull final Patient patient) { save(patient, PatientWritePolicy.UPDATE); }
AdditionalImagesController implements PatientDataController<Attachment> { @Override public void save(@Nonnull final Patient patient) { save(patient, PatientWritePolicy.UPDATE); } }
AdditionalImagesController implements PatientDataController<Attachment> { @Override public void save(@Nonnull final Patient patient) { save(patient, PatientWritePolicy.UPDATE); }  }
AdditionalImagesController implements PatientDataController<Attachment> { @Override public void save(@Nonnull final Patient patient) { save(patient, PatientWritePolicy.UPDATE); }  @Override PatientData<Attachment> load(Patient patient); @Override void save(@Nonnull final 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(); }
AdditionalImagesController implements PatientDataController<Attachment> { @Override public void save(@Nonnull final Patient patient) { save(patient, PatientWritePolicy.UPDATE); }  @Override PatientData<Attachment> load(Patient patient); @Override void save(@Nonnull final 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(); static final EntityReference CLASS_REFERENCE; }