X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Futil%2FDBRefUtilsTest.java;h=c27002945ba451cbc7bf1a46291a16dfcc8cdc15;hb=db4eacee27b836db4126dca551887bfc6652d72a;hp=af5fd1e683c169a6c20483ad6f28409763ccbfb3;hpb=06e3a52df5af8243cdb67c023c8ddd834711ad36;p=jalview.git diff --git a/test/jalview/util/DBRefUtilsTest.java b/test/jalview/util/DBRefUtilsTest.java index af5fd1e..c270029 100644 --- a/test/jalview/util/DBRefUtilsTest.java +++ b/test/jalview/util/DBRefUtilsTest.java @@ -22,7 +22,7 @@ public class DBRefUtilsTest * Test the method that selects DBRefEntry items whose source is in a supplied * list */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testSelectRefs() { assertNull(DBRefUtils.selectRefs(null, null)); @@ -32,10 +32,8 @@ public class DBRefUtilsTest DBRefEntry ref2 = new DBRefEntry("UNIPROT", "1.2", "A12346"); // Source is converted to upper-case by this constructor! DBRefEntry ref3 = new DBRefEntry("Uniprot", "1.2", "A12347"); - DBRefEntry[] dbrefs = new DBRefEntry[] - { ref1, ref2, ref3 }; - String[] sources = new String[] - { "EMBL", "UNIPROT" }; + DBRefEntry[] dbrefs = new DBRefEntry[] { ref1, ref2, ref3 }; + String[] sources = new String[] { "EMBL", "UNIPROT" }; DBRefEntry[] selected = DBRefUtils.selectRefs(dbrefs, sources); assertEquals(3, selected.length); @@ -43,21 +41,18 @@ public class DBRefUtilsTest assertSame(ref2, selected[1]); assertSame(ref3, selected[2]); - sources = new String[] - { "EMBL" }; + sources = new String[] { "EMBL" }; selected = DBRefUtils.selectRefs(dbrefs, sources); assertEquals(1, selected.length); assertSame(ref1, selected[0]); - sources = new String[] - { "UNIPROT" }; + sources = new String[] { "UNIPROT" }; selected = DBRefUtils.selectRefs(dbrefs, sources); assertEquals(2, selected.length); assertSame(ref2, selected[0]); assertSame(ref3, selected[1]); - sources = new String[] - { "Uniprot", "EMBLCDS" }; + sources = new String[] { "Uniprot", "EMBLCDS" }; selected = DBRefUtils.selectRefs(dbrefs, sources); assertNull(selected); } @@ -66,7 +61,7 @@ public class DBRefUtilsTest * Test the method that converts (currently three) database names to a * canonical name (not case-sensitive) */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetCanonicalName() { assertNull(DBRefUtils.getCanonicalName(null)); @@ -83,7 +78,7 @@ public class DBRefUtilsTest DBRefUtils.getCanonicalName("UNIPROTKB/SWISS-CHEESE")); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testIsDasCoordinateSystem() { assertFalse(DBRefUtils.isDasCoordinateSystem(null, null)); @@ -106,8 +101,7 @@ public class DBRefUtilsTest assertTrue(DBRefUtils.isDasCoordinateSystem("Uniprot", new DBRefEntry( "UNIPROT", "v1", "a1"))); assertFalse(DBRefUtils.isDasCoordinateSystem("UNIPROTKB", - new DBRefEntry( - "pdb", "v1", "a1"))); + new DBRefEntry("pdb", "v1", "a1"))); assertTrue(DBRefUtils.isDasCoordinateSystem("EMBL", new DBRefEntry( "EMBL", "v1", "a1"))); @@ -118,7 +112,7 @@ public class DBRefUtilsTest /** * Test 'parsing' a DBRef - non PDB case */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testParseToDbRef() { SequenceI seq = new Sequence("Seq1", "ABCD"); @@ -135,7 +129,7 @@ public class DBRefUtilsTest /** * Test 'parsing' a DBRef - Stockholm PDB format */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testParseToDbRef_PDB() { SequenceI seq = new Sequence("Seq1", "ABCD"); @@ -160,7 +154,7 @@ public class DBRefUtilsTest * Test the method that searches for matches references - case when we are * matching a reference with no mappings */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testSearchRefs_noMapping() { DBRefEntry target = new DBRefEntry("EMBL", "2", "A1234"); @@ -173,12 +167,11 @@ public class DBRefUtilsTest DBRefEntry ref4 = new DBRefEntry("EMBLCDS", "1", "A1234"); // no match // ref5 matches although it has a mapping - ignored DBRefEntry ref5 = new DBRefEntry("EMBL", "1", "A1234"); - ref5.setMap(new Mapping(new MapList(new int[] - { 1, 1 }, new int[] - { 1, 1 }, 1, 1))); + ref5.setMap(new Mapping(new MapList(new int[] { 1, 1 }, new int[] { 1, + 1 }, 1, 1))); - DBRefEntry[] matches = DBRefUtils.searchRefs(new DBRefEntry[] - { ref1, ref2, ref3, ref4, ref5 }, target); + DBRefEntry[] matches = DBRefUtils.searchRefs(new DBRefEntry[] { ref1, + ref2, ref3, ref4, ref5 }, target); assertEquals(3, matches.length); assertSame(ref1, matches[0]); assertSame(ref2, matches[1]); @@ -189,32 +182,29 @@ public class DBRefUtilsTest * Test the method that searches for matches references - case when we are * matching a reference with a mapping */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testSearchRefs_withMapping() { DBRefEntry target = new DBRefEntry("EMBL", "2", "A1234"); - final Mapping map1 = new Mapping(new MapList(new int[] - { 1, 1 }, new int[] - { 1, 1 }, 1, 1)); + final Mapping map1 = new Mapping(new MapList(new int[] { 1, 1 }, + new int[] { 1, 1 }, 1, 1)); target.setMap(map1); // these all match target iff mappings match DBRefEntry ref1 = new DBRefEntry("EMBL", "1", "A1234"); // no map: matches DBRefEntry ref2 = new DBRefEntry("EMBL", "1", "A1234"); // =map: matches - final Mapping map2 = new Mapping(new MapList(new int[] - { 1, 1 }, new int[] - { 1, 1 }, 1, 1)); + final Mapping map2 = new Mapping(new MapList(new int[] { 1, 1 }, + new int[] { 1, 1 }, 1, 1)); ref2.setMap(map2); // different map: no match DBRefEntry ref3 = new DBRefEntry("EMBL", "1", "A1234"); - final Mapping map3 = new Mapping(new MapList(new int[] - { 1, 1 }, new int[] - { 1, 1 }, 2, 2)); + final Mapping map3 = new Mapping(new MapList(new int[] { 1, 1 }, + new int[] { 1, 1 }, 2, 2)); ref3.setMap(map3); - DBRefEntry[] matches = DBRefUtils.searchRefs(new DBRefEntry[] - { ref1, ref2, ref3 }, target); + DBRefEntry[] matches = DBRefUtils.searchRefs(new DBRefEntry[] { ref1, + ref2, ref3 }, target); assertEquals(2, matches.length); assertSame(ref1, matches[0]); assertSame(ref2, matches[1]);