From: gmungoc Date: Sat, 5 Sep 2020 17:07:01 +0000 (+0100) Subject: JAL-3576 unit test for preserving order of colocated features X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=9923abd235a874c87f893219115fe0307d343195;p=jalview.git JAL-3576 unit test for preserving order of colocated features --- diff --git a/test/jalview/datamodel/features/FeatureStoreTest.java b/test/jalview/datamodel/features/FeatureStoreTest.java index c38cb1e..15e2d59 100644 --- a/test/jalview/datamodel/features/FeatureStoreTest.java +++ b/test/jalview/datamodel/features/FeatureStoreTest.java @@ -5,14 +5,14 @@ import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertSame; import static org.testng.Assert.assertTrue; -import jalview.datamodel.SequenceFeature; - import java.util.ArrayList; import java.util.List; import java.util.Set; import org.testng.annotations.Test; +import jalview.datamodel.SequenceFeature; + public class FeatureStoreTest { @@ -86,6 +86,26 @@ public class FeatureStoreTest } @Test(groups = "Functional") + public void testFindFeatures_colocated() + { + FeatureStore fs = new FeatureStore(); + SequenceFeature sf1 = new SequenceFeature("domain", "Cath", 10, 50, Float.NaN, + null); + fs.addFeature(sf1); + SequenceFeature sf2 = new SequenceFeature("domain", "Pfam", 10, 50, Float.NaN, + null); + fs.addFeature(sf2); + List features = fs.findOverlappingFeatures(1, 100); + + /* + * check co-located features are returned in the order they were added + */ + assertEquals(features.size(), 2); + assertSame(features.get(0), sf1); + assertSame(features.get(1), sf2); + } + + @Test(groups = "Functional") public void testFindFeatures_mixed() { FeatureStore fs = new FeatureStore();