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.AssertJUnit.assertFalse;
24 import static org.testng.AssertJUnit.assertTrue;
26 import jalview.util.MapList;
28 import org.testng.annotations.Test;
30 public class DBRefEntryTest
34 * Tests for the method that compares equality of reference (but not mapping)
36 @Test(groups = { "Functional" })
37 public void testEqualRef()
39 DBRefEntry ref1 = new DBRefEntry("UNIPROT", "1", "V71633");
40 assertTrue(ref1.equalRef(ref1));
41 assertFalse(ref1.equalRef(null));
43 // comparison is not case sensitive
44 DBRefEntry ref2 = new DBRefEntry("uniprot", "1", "v71633");
45 assertTrue(ref1.equalRef(ref2));
46 assertTrue(ref2.equalRef(ref1));
48 // source, version and accessionid must match
49 assertFalse(ref1.equalRef(new DBRefEntry("UNIPRO", "1", "V71633")));
50 assertFalse(ref1.equalRef(new DBRefEntry("UNIPROT", "2", "V71633")));
51 assertFalse(ref1.equalRef(new DBRefEntry("UNIPROT", "1", "V71632")));
53 // presence of or differences in mappings are ignored
54 ref1.setMap(new Mapping(new MapList(new int[] { 1, 3 }, new int[] { 1,
56 assertTrue(ref1.equalRef(ref2));
57 assertTrue(ref2.equalRef(ref1));
58 ref1.setMap(new Mapping(new MapList(new int[] { 1, 6 }, new int[] { 1,
60 assertTrue(ref1.equalRef(ref2));
61 assertTrue(ref2.equalRef(ref1));