From: gmungoc Date: Mon, 25 Sep 2017 13:44:56 +0000 (+0100) Subject: JAL-2525 return no features if none matches ontology term! X-Git-Tag: Release_2_10_3b1~126 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=12ba8429c72ec9428f88adb6ae5338a5df63552e;p=jalview.git JAL-2525 return no features if none matches ontology term! --- diff --git a/src/jalview/datamodel/features/SequenceFeatures.java b/src/jalview/datamodel/features/SequenceFeatures.java index 52da8c7..8d5ba58 100644 --- a/src/jalview/datamodel/features/SequenceFeatures.java +++ b/src/jalview/datamodel/features/SequenceFeatures.java @@ -149,6 +149,14 @@ public class SequenceFeatures implements SequenceFeaturesI } Set featureTypes = getFeatureTypes(ontologyTerm); + if (featureTypes.isEmpty()) + { + /* + * no features of the specified type or any sub-type + */ + return new ArrayList<>(); + } + return getAllFeatures(featureTypes.toArray(new String[featureTypes .size()])); } diff --git a/test/jalview/datamodel/features/SequenceFeaturesTest.java b/test/jalview/datamodel/features/SequenceFeaturesTest.java index a144f03..39d6dce 100644 --- a/test/jalview/datamodel/features/SequenceFeaturesTest.java +++ b/test/jalview/datamodel/features/SequenceFeaturesTest.java @@ -1032,6 +1032,9 @@ public class SequenceFeaturesTest assertEquals(features.size(), 2); assertTrue(features.contains(sf2)); assertTrue(features.contains(sf3)); + + features = store.getFeaturesByOntology("sequence_variant"); + assertTrue(features.isEmpty()); } @Test(groups = "Functional")