@Test public void saveUpdatesOnlySpecifiedPropertiesWhenPolicyIsMerge() { final Map<String, String> result = new LinkedHashMap<>(); result.put(MULTIPLE_GESTATION, TRUE); result.put(GESTATION_TWIN, TRUE); result.put(ASSISTED_REPRODUCTION_DONOR_EGG, FALSE); result.put(ASSISTED_REPRODUCTION_DONOR_SPERM, FALSE); final PatientData<String> data = spy(new DictionaryPatientData<>(this.component.getName(), result)); doReturn(data).when(this.patient).getData(this.component.getName()); final BaseProperty baseProperty = mock(BaseProperty.class); when(baseProperty.getValue()).thenReturn(TRUE); when(this.dataHolder.getField(ASSISTED_REPRODUCTION_FERTILITY_MEDS)).thenReturn(baseProperty); this.component.save(this.patient, PatientWritePolicy.MERGE); verify(data, times(1)).containsKey(GESTATION); verify(data, times(1)).containsKey(MULTIPLE_GESTATION); verify(data, times(1)).containsKey(GESTATION_TWIN); verify(data, times(1)).containsKey(ASSISTED_REPRODUCTION_IUI); verify(data, times(1)).containsKey(IVF); verify(data, times(1)).containsKey(ICSI); verify(data, times(1)).containsKey(ASSISTED_REPRODUCTION_FERTILITY_MEDS); verify(data, times(1)).containsKey(ASSISTED_REPRODUCTION_SURROGACY); verify(data, times(1)).containsKey(ASSISTED_REPRODUCTION_DONOR_EGG); verify(data, times(1)).containsKey(ASSISTED_REPRODUCTION_DONOR_SPERM); verify(data, times(1)).get(MULTIPLE_GESTATION); verify(data, times(1)).get(GESTATION_TWIN); verify(data, times(1)).get(ASSISTED_REPRODUCTION_DONOR_EGG); verify(data, times(1)).get(ASSISTED_REPRODUCTION_DONOR_SPERM); verify(data, times(1)).isNamed(); verifyNoMoreInteractions(data); verify(this.doc, times(1)).getXObject(Patient.CLASS_REFERENCE); verify(this.doc, times(1)).getXObject(Patient.CLASS_REFERENCE, true, this.context); verifyNoMoreInteractions(this.doc); verify(this.dataHolder, times(1)).set(MULTIPLE_GESTATION, TRUE, this.context); verify(this.dataHolder, times(1)).set(GESTATION_TWIN, TRUE, this.context); verify(this.dataHolder, times(1)).set(ASSISTED_REPRODUCTION_DONOR_EGG, FALSE, this.context); verify(this.dataHolder, times(1)).set(ASSISTED_REPRODUCTION_DONOR_SPERM, FALSE, this.context); verifyNoMoreInteractions(this.dataHolder); }
@Override public String getName() { return "prenatalPerinatalHistory"; }
PrenatalPerinatalHistoryController extends AbstractComplexController<String> { @Override public String getName() { return "prenatalPerinatalHistory"; } }
PrenatalPerinatalHistoryController extends AbstractComplexController<String> { @Override public String getName() { return "prenatalPerinatalHistory"; }  }
PrenatalPerinatalHistoryController extends AbstractComplexController<String> { @Override public String getName() { return "prenatalPerinatalHistory"; }  @Override String getName(); }
PrenatalPerinatalHistoryController extends AbstractComplexController<String> { @Override public String getName() { return "prenatalPerinatalHistory"; }  @Override String getName();  }