X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Futil%2FDBRefUtilsTest.java;fp=test%2Fjalview%2Futil%2FDBRefUtilsTest.java;h=d4574c0d3be32c489ac283be57e2dd5cdeba9283;hb=57738a1f3c19b1c3a00bd3ac5108f8cd0af32f99;hp=f92e454d83ba0932e11e50c62a9d2721613add1b;hpb=e7338a61f3ce96dadf44ac80b2b32cc5ba4b94c8;p=jalview.git diff --git a/test/jalview/util/DBRefUtilsTest.java b/test/jalview/util/DBRefUtilsTest.java index f92e454..d4574c0 100644 --- a/test/jalview/util/DBRefUtilsTest.java +++ b/test/jalview/util/DBRefUtilsTest.java @@ -63,7 +63,9 @@ 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"); - List dbrefs = Arrays.asList(new DBRefEntry[] { ref1, ref2, ref3 }); + List dbrefs = Arrays + .asList(new DBRefEntry[] + { ref1, ref2, ref3 }); String[] sources = new String[] { "EMBL", "UNIPROT" }; List selected = DBRefUtils.selectRefs(dbrefs, sources); @@ -108,10 +110,12 @@ public class DBRefUtilsTest assertEquals("PDB", DBRefUtils.getCanonicalName("Pdb")); assertEquals("UNIPROT", DBRefUtils.getCanonicalName("uniprotkb/swiss-prot")); - assertEquals("UNIPROT", DBRefUtils.getCanonicalName("uniprotkb/trembl")); + assertEquals("UNIPROT", + DBRefUtils.getCanonicalName("uniprotkb/trembl")); assertEquals("UNIPROT", DBRefUtils.getCanonicalName("UNIPROTKB/SWISS-PROT")); - assertEquals("UNIPROT", DBRefUtils.getCanonicalName("UNIPROTKB/TREMBL")); + assertEquals("UNIPROT", + DBRefUtils.getCanonicalName("UNIPROTKB/TREMBL")); assertEquals("UNIPROTKB/SWISS-CHEESE", DBRefUtils.getCanonicalName("UNIPROTKB/SWISS-CHEESE")); assertEquals("ENSEMBL", DBRefUtils.getCanonicalName("Ensembl")); @@ -121,6 +125,7 @@ public class DBRefUtilsTest assertEquals("pfam", DBRefUtils.getCanonicalName("pfam")); } + /** * Test 'parsing' a DBRef - non PDB case */ @@ -187,12 +192,14 @@ 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))); - List matches = DBRefUtils.searchRefs( - Arrays.asList(new DBRefEntry[] { - ref1, ref2, ref3, ref4, ref5 }), target, DBRefUtils.SEARCH_MODE_FULL); + List matches = DBRefUtils + .searchRefs(Arrays.asList(new DBRefEntry[] + { ref1, ref2, ref3, ref4, ref5 }), target, + DBRefUtils.SEARCH_MODE_FULL); assertEquals(3, matches.size()); assertSame(ref1, matches.get(0)); assertSame(ref2, matches.get(1)); @@ -207,26 +214,29 @@ public class DBRefUtilsTest 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); - List matches = DBRefUtils.searchRefs( - Arrays.asList(new DBRefEntry[] { - ref1, ref2, ref3 }), target, DBRefUtils.SEARCH_MODE_FULL); + List matches = DBRefUtils + .searchRefs(Arrays.asList(new DBRefEntry[] + { ref1, ref2, ref3 }), target, DBRefUtils.SEARCH_MODE_FULL); assertEquals(2, matches.size()); assertSame(ref1, matches.get(0)); assertSame(ref2, matches.get(1)); @@ -247,11 +257,13 @@ public class DBRefUtilsTest DBRefEntry ref4 = new DBRefEntry("EMBLCDS", "1", "A1235"); // 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))); - List dbrefs = Arrays.asList(new DBRefEntry[] { - ref1, ref2, ref3, ref4, ref5 }); + List dbrefs = Arrays + .asList(new DBRefEntry[] + { ref1, ref2, ref3, ref4, ref5 }); List matches = DBRefUtils.searchRefs(dbrefs, "A1234"); assertEquals(3, matches.size()); assertSame(ref1, matches.get(0)); @@ -276,12 +288,14 @@ 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", "A1237"); - 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))); - List matches = DBRefUtils.searchRefs( - Arrays.asList(new DBRefEntry[] { - ref1, ref2, ref3, ref4, ref5 }), target, DBRefUtils.SEARCH_MODE_FULL); + List matches = DBRefUtils + .searchRefs(Arrays.asList(new DBRefEntry[] + { ref1, ref2, ref3, ref4, ref5 }), target, + DBRefUtils.SEARCH_MODE_FULL); assertEquals(4, matches.size()); assertSame(ref1, matches.get(0)); assertSame(ref2, matches.get(1));