JAL-3576 unit test for preserving order of colocated features
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Sat, 5 Sep 2020 17:07:01 +0000 (18:07 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Sat, 5 Sep 2020 17:07:01 +0000 (18:07 +0100)
test/jalview/datamodel/features/FeatureStoreTest.java

index c38cb1e..15e2d59 100644 (file)
@@ -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<SequenceFeature> 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();