JAL-2106 stricter check for 1:1 mapping (same numbering on both sides, and word size...
[jalview.git] / test / jalview / datamodel / DBRefEntryTest.java
index 8cc31e0..09d9df1 100644 (file)
@@ -145,32 +145,53 @@ public class DBRefEntryTest
     DBRefEntry dbr = new DBRefEntry(DBRefSource.UNIPROT, "", "Q12345");
     assertTrue(dbr.isPrimary());
     /*
-     *  1:1 mapping with shift
+     *  1:1 mapping 
      */
-    dbr.setMap(new Mapping(null, new int[] { 1, 3 }, new int[] { 5, 9 }, 1,
+    dbr.setMap(new Mapping(null, new int[] { 1, 3 }, new int[] { 1, 3 }, 1,
             1));
     assertTrue(dbr.isPrimary());
+    /*
+     * Version string is prefixed with another dbref source string (fail)
+     */
+    dbr.setVersion(DBRefSource.EMBL + ":0");
+    assertFalse(dbr.isPrimary());
+
+    /*
+     * Version string is alphanumeric
+     */
+    dbr.setVersion("0.1.b");
+    assertTrue(dbr.isPrimary());
 
     /*
-     *  1:1 mapping with shift and sequenceRef
+     *  1:1 mapping with shift (fail)
+     */
+    dbr.setMap(new Mapping(null, new int[] { 1, 3 }, new int[] { 2, 4 }, 1,
+            1));
+    assertFalse(dbr.isPrimary());
+
+    /*
+     *  1:1 mapping and sequenceRef (fail)
      */
     dbr.setMap(new Mapping(new Sequence("foo", "ASDF"), new int[] { 1, 3 },
-            new int[] { 5, 9 }, 1, 1));
+            new int[] { 1, 3 }, 1, 1));
     assertFalse(dbr.isPrimary());
 
     /*
-     * 1:3 mapping with shift (fail)
+     * 1:3 mapping (fail)
      */
-    dbr.setMap(new Mapping(null, new int[] { 1, 3 }, new int[] { 5, 9 }, 1,
+    dbr.setMap(new Mapping(null, new int[] { 1, 3 }, new int[] { 1, 3 }, 1,
             3));
     assertFalse(dbr.isPrimary());
     /*
-     * 2:2 mapping with shift (expected fail, but maybe not realistic)
+     * 2:2 mapping with shift (expected fail, but maybe use case for a pass)
      */
-    dbr.setMap(new Mapping(null, new int[] { 1, 3 }, new int[] { 5, 9 }, 2,
+    dbr.setMap(new Mapping(null, new int[] { 1, 3 }, new int[] { 1, 3 }, 2,
             2));
     assertFalse(dbr.isPrimary());
 
+    /*
+     * Version string is prefixed with another dbref source string
+     */
     dbr.setVersion(DBRefSource.EMBL + ":0");
     assertFalse(dbr.isPrimary());