JAL-3863 fix test and note about fragility
authorJim Procter <j.procter@dundee.ac.uk>
Mon, 30 Aug 2021 10:51:00 +0000 (11:51 +0100)
committerJim Procter <j.procter@dundee.ac.uk>
Mon, 30 Aug 2021 11:17:32 +0000 (12:17 +0100)
test/jalview/ws/dbsources/UniprotTest.java

index 31cd513..8bfaef0 100644 (file)
@@ -27,6 +27,7 @@ import static org.testng.AssertJUnit.assertNull;
 import static org.testng.AssertJUnit.assertTrue;
 
 import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.DBRefSource;
 import jalview.datamodel.SequenceI;
 import jalview.gui.JvOptionPane;
 import jalview.util.DBRefUtils;
@@ -225,6 +226,12 @@ public class UniprotTest
     List<DBRefEntry> res = DBRefUtils.searchRefs(seq.getPrimaryDBRefs(), "A9CKP4");
     assertEquals(1,res.size());
     assertTrue(res.get(0).isCanonical());
+    res = DBRefUtils.searchRefsForSource(seq.getDBRefs(), DBRefSource.UNIPROT);
+    assertEquals(2,res.size());
+    /*
+     * NB this test fragile - relies on ordering being preserved
+     */
+    assertTrue(res.get(0).isCanonical());
     assertFalse(res.get(1).isCanonical());
   }