JAL-3863 promote non-canonical version of dbref to a canonical one
[jalview.git] / test / jalview / datamodel / SequenceTest.java
index 5ae7dd9..e549978 100644 (file)
@@ -2181,9 +2181,19 @@ public class SequenceTest
     Sequence toSeq = new Sequence("MYSEQ","THISISASEQ");
     origSeq.addDBRef(new DBRefEntry("UNIPROT", "0", "Q12345", null, true));
     toSeq.transferAnnotation(origSeq, null);
-    assertTrue(toSeq.getDBRefs().size()>0);
+    assertTrue(toSeq.getDBRefs().size()==1);
     
     assertTrue(toSeq.getDBRefs().get(0).isCanonical());
     
+    // check for promotion of non-canonical 
+    // to canonical (e.g. fetch-db-refs on a jalview project pre 2.11.2)
+    toSeq.setDBRefs(null);
+    toSeq.addDBRef(new DBRefEntry("UNIPROT", "0", "Q12345", null, false));
+    toSeq.transferAnnotation(origSeq, null);
+    assertTrue(toSeq.getDBRefs().size()==1);
+    
+    assertTrue("Promotion of non-canonical DBRefEntry failed",toSeq.getDBRefs().get(0).isCanonical());
+    
+    
   }
 }