/* * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9.0b2) * Copyright (C) 2015 The Jalview Authors * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 * of the License, or (at your option) any later version. * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Jalview. If not, see . * The Jalview Authors are detailed in the 'AUTHORS' file. */ package jalview.datamodel; import static org.testng.AssertJUnit.assertFalse; import static org.testng.AssertJUnit.assertTrue; import jalview.util.MapList; import org.testng.annotations.Test; public class DBRefEntryTest { /** * Tests for the method that compares equality of reference (but not mapping) */ @Test(groups = { "Functional" }) public void testEqualRef() { DBRefEntry ref1 = new DBRefEntry("UNIPROT", "1", "V71633"); assertTrue(ref1.equalRef(ref1)); assertFalse(ref1.equalRef(null)); // comparison is not case sensitive DBRefEntry ref2 = new DBRefEntry("uniprot", "1", "v71633"); assertTrue(ref1.equalRef(ref2)); assertTrue(ref2.equalRef(ref1)); // source, version and accessionid must match assertFalse(ref1.equalRef(new DBRefEntry("UNIPRO", "1", "V71633"))); assertFalse(ref1.equalRef(new DBRefEntry("UNIPROT", "2", "V71633"))); assertFalse(ref1.equalRef(new DBRefEntry("UNIPROT", "1", "V71632"))); // presence of or differences in mappings are ignored ref1.setMap(new Mapping(new MapList(new int[] { 1, 3 }, new int[] { 1, 1 }, 3, 1))); assertTrue(ref1.equalRef(ref2)); assertTrue(ref2.equalRef(ref1)); ref1.setMap(new Mapping(new MapList(new int[] { 1, 6 }, new int[] { 1, 2 }, 3, 1))); assertTrue(ref1.equalRef(ref2)); assertTrue(ref2.equalRef(ref1)); } }