X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fdatamodel%2FPDBEntryTest.java;h=a0068339de7e4a05960925265ab891cde0e9a89a;hb=4bc5c1c97bd08007b2ac9ccfd9b3cb29eac10193;hp=e9d5cb2151aeeb0381a6c72f2ddc681e44129d96;hpb=e838644df5d5a10a16cf0ad7fb23d24dd7d2729a;p=jalview.git diff --git a/test/jalview/datamodel/PDBEntryTest.java b/test/jalview/datamodel/PDBEntryTest.java index e9d5cb2..a006833 100644 --- a/test/jalview/datamodel/PDBEntryTest.java +++ b/test/jalview/datamodel/PDBEntryTest.java @@ -31,15 +31,24 @@ import static org.testng.Assert.assertTrue; import static org.testng.Assert.fail; import jalview.datamodel.PDBEntry.Type; +import jalview.gui.JvOptionPane; //import org.testng.Assert; import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; public class PDBEntryTest { + @BeforeClass(alwaysRun = true) + public void setUpJvOptionPane() + { + JvOptionPane.setInteractiveMode(false); + JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); + } + @BeforeMethod(alwaysRun = true) public void setUp() throws Exception { @@ -199,7 +208,7 @@ public class PDBEntryTest assertTrue(pdb1.updateFrom(pdb2)); assertEquals(pdb1.getFile(), "filePath"); assertEquals(pdb1.getType(), Type.FILE.toString()); - + assertEquals(pdb1.getChainCode(), "B"); /* * change of file is not allowed */ @@ -260,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" })