From 9923abd235a874c87f893219115fe0307d343195 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Sat, 5 Sep 2020 18:07:01 +0100 Subject: [PATCH] JAL-3576 unit test for preserving order of colocated features --- .../datamodel/features/FeatureStoreTest.java | 24 ++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) 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(); -- 1.7.10.2