@Test public void saveUpdatesVariantsWhenPolicyIsUpdate() throws XWikiException { final List<Map<String, String>> data = new LinkedList<>(); Map<String, String> item = new HashMap<>(); item.put(VARIANT_KEY, VARIANT_1); item.put(GENE_KEY, GENE_1); item.put(START_POSITION_KEY, POS_22); data.add(item); item = new HashMap<>(); item.put(VARIANT_KEY, VARIANT_2); item.put(GENE_KEY, GENE_2); data.add(item); when(this.patient.<Map<String, String>>getData(CONTROLLER_NAME)) .thenReturn(new IndexedPatientData<>(CONTROLLER_NAME, data)); when(this.context.getWiki()).thenReturn(mock(XWiki.class)); BaseObject o1 = mock(BaseObject.class); BaseObject o2 = mock(BaseObject.class); when(this.doc.newXObject(VariantListController.VARIANT_CLASS_REFERENCE, this.context)).thenReturn(o1, o2); this.component.save(this.patient); verify(this.doc).removeXObjects(VariantListController.VARIANT_CLASS_REFERENCE); verify(o1).set(GENE_KEY, GENE_1, this.context); verify(o1).set(VARIANT_KEY, VARIANT_1, this.context); verify(o1).setIntValue(START_POSITION_KEY, 22); verifyNoMoreInteractions(o1); verify(o2).set(GENE_KEY, GENE_2, this.context); verify(o2).set(VARIANT_KEY, VARIANT_2, this.context); verifyNoMoreInteractions(o2); }
@Override public void save(Patient patient) { save(patient, PatientWritePolicy.UPDATE); }
VariantListController extends AbstractComplexController<Map<String, String>> { @Override public void save(Patient patient) { save(patient, PatientWritePolicy.UPDATE); } }
VariantListController extends AbstractComplexController<Map<String, String>> { @Override public void save(Patient patient) { save(patient, PatientWritePolicy.UPDATE); }  }
VariantListController extends AbstractComplexController<Map<String, String>> { @Override public void save(Patient patient) { save(patient, PatientWritePolicy.UPDATE); }  @Override String getName(); @Override PatientData<Map<String, String>> load(Patient patient); @SuppressWarnings("checkstyle:CyclomaticComplexity") @Override void writeJSON(Patient patient, JSONObject json, Collection<String> selectedFieldNames); @Override PatientData<Map<String, String>> readJSON(JSONObject json); @Override void save(Patient patient); @Override void save(@Nonnull final Patient patient, @Nonnull final PatientWritePolicy policy); }
VariantListController extends AbstractComplexController<Map<String, String>> { @Override public void save(Patient patient) { save(patient, PatientWritePolicy.UPDATE); }  @Override String getName(); @Override PatientData<Map<String, String>> load(Patient patient); @SuppressWarnings("checkstyle:CyclomaticComplexity") @Override void writeJSON(Patient patient, JSONObject json, Collection<String> selectedFieldNames); @Override PatientData<Map<String, String>> readJSON(JSONObject json); @Override void save(Patient patient); @Override void save(@Nonnull final Patient patient, @Nonnull final PatientWritePolicy policy);  }