JAL-3956 - PDBEntry objects constructed from 3D-Beacons have authoritative IDs overri...
[jalview.git] / test / jalview / datamodel / PDBEntryTest.java
index 198cde3..80b7376 100644 (file)
@@ -90,7 +90,7 @@ public class PDBEntryTest
     PDBEntry case9 = new PDBEntry("1xyz", "A", null, "x/y/z/File");
     // different file only
     PDBEntry case10 = new PDBEntry("1xyz", "A", null, "a/b/c/File");
-
+    
     /*
      * assertEquals will invoke PDBEntry.equals()
      */
@@ -269,6 +269,21 @@ public class PDBEntryTest
     pdb2.setProperty("hello", "moon");
     assertTrue(pdb1.updateFrom(pdb2));
     assertEquals(pdb1.getProperty("hello"), "moon");
+    
+    /*
+    * different id but authoritative
+    */
+    pdb1 = new PDBEntry("af:1xyz", "A", null, "a/b/c/File");
+    pdb2 = new PDBEntry("af-1xyz", "A", null, "a/b/c/File");
+    pdb1.setAuthoritative(true);
+
+    assertTrue(pdb1.isAuthoritative());
+    assertFalse(pdb2.isAuthoritative());
+    // can update pdb1 (authoritative) from pdb2 (non-authoritative)
+    assertTrue(pdb1.updateFrom(pdb2));
+    // but the ID must remain the same
+    assertEquals(pdb1.getId(),"af:1xyz");
+    
   }
 
   @Test(groups = { "Functional" })