2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.datamodel;
23 import static org.testng.Assert.assertEquals;
24 import static org.testng.Assert.assertFalse;
25 import static org.testng.Assert.assertNotEquals;
26 import static org.testng.Assert.assertNull;
28 //import org.testng.Assert;
29 import org.testng.annotations.AfterMethod;
30 import org.testng.annotations.BeforeMethod;
31 import org.testng.annotations.Test;
33 public class PDBEntryTest
36 @BeforeMethod(alwaysRun = true)
37 public void setUp() throws Exception
41 @AfterMethod(alwaysRun = true)
42 public void tearDown() throws Exception
46 @Test(groups = { "Functional" })
47 public void testEquals()
49 PDBEntry pdbEntry = new PDBEntry("1xyz", "A", PDBEntry.Type.PDB,
52 PDBEntry case1 = new PDBEntry("1XYZ", "A", PDBEntry.Type.PDB,
54 PDBEntry case2 = new PDBEntry("1xyz", "a", PDBEntry.Type.PDB,
56 PDBEntry case3 = new PDBEntry("1xyz", "A", PDBEntry.Type.FILE,
58 PDBEntry case4 = new PDBEntry(null, null, null, null);
59 PDBEntry case5 = new PDBEntry(null, "A", PDBEntry.Type.PDB,
61 PDBEntry case6 = new PDBEntry("1xyz", null, PDBEntry.Type.PDB,
63 PDBEntry case7 = new PDBEntry("1xyz", "A", null, "x/y/z/File");
64 PDBEntry case8 = new PDBEntry("1xyz", "A", PDBEntry.Type.PDB, null);
65 PDBEntry case9 = new PDBEntry("1xyz", "A", null, "x/y/z/File");
68 * assertions will invoke PDBEntry.equals()
70 assertFalse(pdbEntry.equals(null));
71 assertFalse(pdbEntry.equals("a"));
72 assertEquals(case1, pdbEntry);
73 assertEquals(case2, pdbEntry);
74 assertNotEquals(case3, pdbEntry);
75 assertNotEquals(case4, pdbEntry);
76 assertNotEquals(case5, pdbEntry);
77 assertNotEquals(case6, pdbEntry);
78 assertNotEquals(case7, pdbEntry);
79 assertEquals(case8, pdbEntry);
80 assertEquals(case7, case9);
83 * change string wrapper property to string...
85 case1.setProperty("chain_code", "a");
86 assertFalse(pdbEntry.equals(case1));
87 assertFalse(case1.equals(pdbEntry));
90 @Test(groups = { "Functional" })
91 public void testSetChainCode()
93 PDBEntry pdbEntry = new PDBEntry("1xyz", null, PDBEntry.Type.PDB,
95 assertNull(pdbEntry.getChainCode());
97 pdbEntry.setChainCode("a");
98 assertEquals("a", pdbEntry.getChainCode());
100 pdbEntry.setChainCode(null);
101 assertNull(pdbEntry.getChainCode());