@Test public void loadReturnsNormallyWhenContextComponentManagerThrowsComponentLookupException() throws ComponentLookupException { ComponentLookupException exception = new ComponentLookupException("message"); doThrow(exception).when(this.contextComponentManager).getInstance(CoreExtensionRepository.class); PatientData<String> result = this.mocker.getComponentUnderTest().load(this.patient); Assert.assertEquals("1.0", result.get("first_version")); Assert.assertEquals("2.0", result.get("second_version")); Assert.assertEquals(2, result.size()); verify(this.mocker.getMockedLogger()).error("Could not find DistributionManager component"); }
@Override public PatientData<String> load(Patient patient) { Map<String, String> versions = new LinkedHashMap<>(); try { XWikiDocument doc = patient.getXDocument(); addOntologyVersions(doc, versions); addPhenoTipsVersion(versions); } catch (Exception e) { this.logger.error(ERROR_MESSAGE_LOAD_FAILED, e.getMessage()); } return new DictionaryPatientData<>(getName(), versions); }
VersionsController extends AbstractSimpleController implements PatientDataController<String> { @Override public PatientData<String> load(Patient patient) { Map<String, String> versions = new LinkedHashMap<>(); try { XWikiDocument doc = patient.getXDocument(); addOntologyVersions(doc, versions); addPhenoTipsVersion(versions); } catch (Exception e) { this.logger.error(ERROR_MESSAGE_LOAD_FAILED, e.getMessage()); } return new DictionaryPatientData<>(getName(), versions); } }
VersionsController extends AbstractSimpleController implements PatientDataController<String> { @Override public PatientData<String> load(Patient patient) { Map<String, String> versions = new LinkedHashMap<>(); try { XWikiDocument doc = patient.getXDocument(); addOntologyVersions(doc, versions); addPhenoTipsVersion(versions); } catch (Exception e) { this.logger.error(ERROR_MESSAGE_LOAD_FAILED, e.getMessage()); } return new DictionaryPatientData<>(getName(), versions); }  }
VersionsController extends AbstractSimpleController implements PatientDataController<String> { @Override public PatientData<String> load(Patient patient) { Map<String, String> versions = new LinkedHashMap<>(); try { XWikiDocument doc = patient.getXDocument(); addOntologyVersions(doc, versions); addPhenoTipsVersion(versions); } catch (Exception e) { this.logger.error(ERROR_MESSAGE_LOAD_FAILED, e.getMessage()); } return new DictionaryPatientData<>(getName(), versions); }  @Override PatientData<String> load(Patient patient); @Override void writeJSON(Patient patient, JSONObject json, Collection<String> selectedFieldNames); @Override String getName(); static String getEnablingFieldName(); }
VersionsController extends AbstractSimpleController implements PatientDataController<String> { @Override public PatientData<String> load(Patient patient) { Map<String, String> versions = new LinkedHashMap<>(); try { XWikiDocument doc = patient.getXDocument(); addOntologyVersions(doc, versions); addPhenoTipsVersion(versions); } catch (Exception e) { this.logger.error(ERROR_MESSAGE_LOAD_FAILED, e.getMessage()); } return new DictionaryPatientData<>(getName(), versions); }  @Override PatientData<String> load(Patient patient); @Override void writeJSON(Patient patient, JSONObject json, Collection<String> selectedFieldNames); @Override String getName(); static String getEnablingFieldName();  }