X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fanalysis%2FAlignmentUtilsTests.java;h=b45547ea1022f481603d292cf013fad0b4ea8f40;hb=48e68905336d8ee17ee6b3903d80b36bac8c56cf;hp=128bc5c8e994369b950840d62d35f0cb093546f0;hpb=9b85e1552fa57f02cf6cd312cfbd7efdfd079ea3;p=jalview.git diff --git a/test/jalview/analysis/AlignmentUtilsTests.java b/test/jalview/analysis/AlignmentUtilsTests.java index 128bc5c..b45547e 100644 --- a/test/jalview/analysis/AlignmentUtilsTests.java +++ b/test/jalview/analysis/AlignmentUtilsTests.java @@ -27,7 +27,16 @@ import static org.testng.AssertJUnit.assertNull; import static org.testng.AssertJUnit.assertSame; import static org.testng.AssertJUnit.assertTrue; -import jalview.analysis.AlignmentUtils.DnaVariant; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; + +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + import jalview.datamodel.AlignedCodonFrame; import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentAnnotation; @@ -41,7 +50,6 @@ import jalview.datamodel.SearchResultsI; import jalview.datamodel.Sequence; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; -import jalview.datamodel.features.SequenceFeatures; import jalview.gui.JvOptionPane; import jalview.io.AppletFormatAdapter; import jalview.io.DataSourceType; @@ -52,17 +60,6 @@ import jalview.io.gff.SequenceOntologyI; import jalview.util.MapList; import jalview.util.MappingUtils; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.TreeMap; - -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - public class AlignmentUtilsTests { private static Sequence ts = new Sequence("short", @@ -974,7 +971,7 @@ public class AlignmentUtilsTests assertTrue(AlignmentUtils.haveCrossRef(seq2, seq1)); // now the other way round - seq1.setDBRefs(null); + seq1.setDBRefs(null); seq2.addDBRef(new DBRefEntry("EMBL", "1", "A12345")); assertTrue(AlignmentUtils.haveCrossRef(seq1, seq2)); assertTrue(AlignmentUtils.haveCrossRef(seq2, seq1)); @@ -1052,11 +1049,11 @@ public class AlignmentUtilsTests DBRefEntry dna1xref = new DBRefEntry("UNIPROT", "ENSEMBL", "pep1", new Mapping(mapfordna1)); dna1.addDBRef(dna1xref); - assertEquals(2, dna1.getDBRefs().length); // to self and to pep1 + assertEquals(2, dna1.getDBRefs().size()); // to self and to pep1 DBRefEntry dna2xref = new DBRefEntry("UNIPROT", "ENSEMBL", "pep2", new Mapping(mapfordna2)); dna2.addDBRef(dna2xref); - assertEquals(2, dna2.getDBRefs().length); // to self and to pep2 + assertEquals(2, dna2.getDBRefs().size()); // to self and to pep2 /* * execute method under test: @@ -1084,8 +1081,8 @@ public class AlignmentUtilsTests * verify CDS has a dbref with mapping to peptide */ assertNotNull(cds1Dss.getDBRefs()); - assertEquals(2, cds1Dss.getDBRefs().length); - dbref = cds1Dss.getDBRefs()[0]; + assertEquals(2, cds1Dss.getDBRefs().size()); + dbref = cds1Dss.getDBRefs().get(0); assertEquals(dna1xref.getSource(), dbref.getSource()); // version is via ensembl's primary ref assertEquals(dna1xref.getVersion(), dbref.getVersion()); @@ -1101,8 +1098,8 @@ public class AlignmentUtilsTests */ assertNotNull(pep1.getDBRefs()); // FIXME pep1.getDBRefs() is 1 - is that the correct behaviour ? - assertEquals(2, pep1.getDBRefs().length); - dbref = pep1.getDBRefs()[1]; + assertEquals(2, pep1.getDBRefs().size()); + dbref = pep1.getDBRefs().get(1); assertEquals("ENSEMBL", dbref.getSource()); assertEquals("0", dbref.getVersion()); assertEquals("CDS|dna1", dbref.getAccessionId()); @@ -1113,14 +1110,14 @@ public class AlignmentUtilsTests /* * verify cDNA has added a dbref with mapping to CDS */ - assertEquals(3, dna1.getDBRefs().length); - DBRefEntry dbRefEntry = dna1.getDBRefs()[2]; + assertEquals(3, dna1.getDBRefs().size()); + DBRefEntry dbRefEntry = dna1.getDBRefs().get(2); assertSame(cds1Dss, dbRefEntry.getMap().getTo()); MapList dnaToCdsMapping = new MapList(new int[] { 4, 6, 10, 12 }, new int[] { 1, 6 }, 1, 1); assertEquals(dnaToCdsMapping, dbRefEntry.getMap().getMap()); - assertEquals(3, dna2.getDBRefs().length); - dbRefEntry = dna2.getDBRefs()[2]; + assertEquals(3, dna2.getDBRefs().size()); + dbRefEntry = dna2.getDBRefs().get(2); assertSame(cds2Dss, dbRefEntry.getMap().getTo()); dnaToCdsMapping = new MapList(new int[] { 1, 3, 7, 9, 13, 15 }, new int[] { 1, 9 }, 1, 1); @@ -1129,14 +1126,14 @@ public class AlignmentUtilsTests /* * verify CDS has added a dbref with mapping to cDNA */ - assertEquals(2, cds1Dss.getDBRefs().length); - dbRefEntry = cds1Dss.getDBRefs()[1]; + assertEquals(2, cds1Dss.getDBRefs().size()); + dbRefEntry = cds1Dss.getDBRefs().get(1); assertSame(dna1.getDatasetSequence(), dbRefEntry.getMap().getTo()); MapList cdsToDnaMapping = new MapList(new int[] { 1, 6 }, new int[] { 4, 6, 10, 12 }, 1, 1); assertEquals(cdsToDnaMapping, dbRefEntry.getMap().getMap()); - assertEquals(2, cds2Dss.getDBRefs().length); - dbRefEntry = cds2Dss.getDBRefs()[1]; + assertEquals(2, cds2Dss.getDBRefs().size()); + dbRefEntry = cds2Dss.getDBRefs().get(1); assertSame(dna2.getDatasetSequence(), dbRefEntry.getMap().getTo()); cdsToDnaMapping = new MapList(new int[] { 1, 9 }, new int[] { 1, 3, 7, 9, 13, 15 }, 1, 1);