@Test public void nullXPropertiesDontCauseErrorsWhenSearchingMetadata() throws XWikiException { XWikiDocument doc = mock(XWikiDocument.class); ListProperty prop = mock(ListProperty.class); when(prop.getName()).thenReturn(TYPE_PHENOTYPE); List<BaseObject> metas = new ArrayList<>(); BaseObject meta = mock(BaseObject.class); StringProperty temp = new StringProperty(); temp.setValue(TYPE_PHENOTYPE); when(meta.get("target_property_name")).thenReturn(null, null, null, temp); temp = new StringProperty(); temp.setValue(HP0000100); when(meta.get("target_property_value")).thenReturn(null, temp, null, temp); when(meta.getLargeStringValue("comments")).thenReturn("Some comments"); metas.add(meta); when(doc.getXObjects(FeatureMetadatum.CLASS_REFERENCE)).thenReturn(metas); Assert.assertEquals("", new PhenoTipsFeature(doc, prop, HP0000100).getNotes()); Assert.assertEquals("", new PhenoTipsFeature(doc, prop, HP0000100).getNotes()); Assert.assertEquals("", new PhenoTipsFeature(doc, prop, HP0000100).getNotes()); Assert.assertEquals("Some comments", new PhenoTipsFeature(doc, prop, HP0000100).getNotes()); }
@Override public String getNotes() { return this.notes; }
PhenoTipsFeature extends AbstractPhenoTipsVocabularyProperty implements Feature { @Override public String getNotes() { return this.notes; } }
PhenoTipsFeature extends AbstractPhenoTipsVocabularyProperty implements Feature { @Override public String getNotes() { return this.notes; } PhenoTipsFeature(XWikiDocument doc, ListProperty property, String value);  PhenoTipsFeature(JSONObject json); }
PhenoTipsFeature extends AbstractPhenoTipsVocabularyProperty implements Feature { @Override public String getNotes() { return this.notes; } PhenoTipsFeature(XWikiDocument doc, ListProperty property, String value);  PhenoTipsFeature(JSONObject json); @Override String getType(); @Override boolean isPresent(); @Override String getValue(); @Override Map<String, ? extends FeatureMetadatum> getMetadata(); @Override String getNotes(); @Override String getPropertyName(); @Override List<String> getCategories(); @Override JSONObject toJSON(); }
PhenoTipsFeature extends AbstractPhenoTipsVocabularyProperty implements Feature { @Override public String getNotes() { return this.notes; } PhenoTipsFeature(XWikiDocument doc, ListProperty property, String value);  PhenoTipsFeature(JSONObject json); @Override String getType(); @Override boolean isPresent(); @Override String getValue(); @Override Map<String, ? extends FeatureMetadatum> getMetadata(); @Override String getNotes(); @Override String getPropertyName(); @Override List<String> getCategories(); @Override JSONObject toJSON(); static final String META_PROPERTY_NAME; static final String META_PROPERTY_VALUE; static final String META_PROPERTY_CATEGORIES; static final EntityReference CATEGORY_CLASS_REFERENCE; static final String NEGATIVE_PHENOTYPE_PREFIX; }