+
+ @Test(groups = { "Functional" })
+ public void testIsPrimary()
+ {
+ DBRefEntry dbr = new DBRefEntry(DBRefSource.UNIPROT, "", "Q12345");
+ assertTrue(dbr.isPrimary());
+ /*
+ * 1:1 mapping with shift
+ */
+ dbr.setMap(new Mapping(null, new int[] { 1, 3 }, new int[] { 5, 9 }, 1,
+ 1));
+ assertTrue(dbr.isPrimary());
+
+ /*
+ * 1:1 mapping with shift and sequenceRef
+ */
+ dbr.setMap(new Mapping(new Sequence("foo", "ASDF"), new int[] { 1, 3 },
+ new int[] { 5, 9 }, 1, 1));
+ assertFalse(dbr.isPrimary());
+
+ /*
+ * 1:3 mapping with shift (fail)
+ */
+ dbr.setMap(new Mapping(null, new int[] { 1, 3 }, new int[] { 5, 9 }, 1,
+ 3));
+ assertFalse(dbr.isPrimary());
+ /*
+ * 2:2 mapping with shift (expected fail, but maybe not realistic)
+ */
+ dbr.setMap(new Mapping(null, new int[] { 1, 3 }, new int[] { 5, 9 }, 2,
+ 2));
+ assertFalse(dbr.isPrimary());
+
+ dbr.setVersion(DBRefSource.EMBL + ":0");
+ assertFalse(dbr.isPrimary());
+
+ }