From: Jim Procter Date: Thu, 10 Sep 2015 03:59:59 +0000 (+0100) Subject: JAL-1645 source formatting and organise imports X-Git-Tag: Release_2_10_0~431 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=52288466dd1e71946a06fd1e6ea15fa8e652c693;p=jalview.git JAL-1645 source formatting and organise imports --- diff --git a/test/MCview/AtomTest.java b/test/MCview/AtomTest.java index 0171eee..4fea613 100644 --- a/test/MCview/AtomTest.java +++ b/test/MCview/AtomTest.java @@ -12,7 +12,7 @@ public class AtomTest * Test the constructor that parses a PDB file format ATOM line. Fields are in * fixed column positions */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testStringConstructor() { Atom a = new Atom( @@ -35,7 +35,7 @@ public class AtomTest * Test the case where occupancy and temp factor are blank - should default to * 1 */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testStringConstructor_blankOccupancyTempFactor() { Atom a = new Atom( @@ -47,7 +47,7 @@ public class AtomTest /** * Parsing non-numeric data as Atom throws an exception */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testStringConstructor_malformed() { try diff --git a/test/MCview/BondTest.java b/test/MCview/BondTest.java index 4bdfff7..47ba514 100644 --- a/test/MCview/BondTest.java +++ b/test/MCview/BondTest.java @@ -7,7 +7,7 @@ import org.testng.annotations.Test; public class BondTest { - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testTranslate() { Atom a1 = new Atom(1f, 2f, 3f); diff --git a/test/MCview/PDBChainTest.java b/test/MCview/PDBChainTest.java index b84ca28..907c500 100644 --- a/test/MCview/PDBChainTest.java +++ b/test/MCview/PDBChainTest.java @@ -38,7 +38,7 @@ public class PDBChainTest c = new PDBChain("1GAQ", "A"); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetNewlineString() { assertEquals(System.lineSeparator(), c.getNewlineString()); @@ -46,7 +46,7 @@ public class PDBChainTest assertEquals("gaga", c.getNewlineString()); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testPrint() { c.offset = 7; @@ -74,7 +74,7 @@ public class PDBChainTest * Test the method that constructs a Bond between two atoms and adds it to the * chain's list of bonds */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testMakeBond() { /* @@ -109,7 +109,7 @@ public class PDBChainTest assertEquals(3f, b2.end[2], 0.0001f); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testSetChainColours_colour() { c.makeBond(a1, a2); @@ -126,7 +126,7 @@ public class PDBChainTest * Test setting bond start/end colours based on a colour scheme i.e. colour by * residue */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testSetChainColours_colourScheme() { Color alaColour = new Color(204, 255, 0); @@ -154,7 +154,7 @@ public class PDBChainTest assertEquals(Color.gray, b.endCol); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetChargeColour() { assertEquals(Color.red, PDBChain.getChargeColour("ASP")); @@ -169,7 +169,7 @@ public class PDBChainTest /** * Test the method that sets bond start/end colours by residue charge property */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testSetChargeColours() { a1.resName = "ASP"; // red @@ -198,7 +198,7 @@ public class PDBChainTest /** * Test the method that converts the raw list of atoms to a list of residues */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testMakeResidueList_noAnnotation() { Vector atoms = new Vector(); @@ -256,35 +256,35 @@ public class PDBChainTest * Test the method that converts the raw list of atoms to a list of residues, * including parsing of tempFactor to an alignment annotation */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testMakeResidueList_withTempFactor() { Vector atoms = new Vector(); c.atoms = atoms; atoms.add(makeAtom(4, "N", "MET")); - atoms.get(atoms.size()-1).tfactor = 1f; + atoms.get(atoms.size() - 1).tfactor = 1f; atoms.add(makeAtom(4, "CA", "MET")); - atoms.get(atoms.size()-1).tfactor = 2f; + atoms.get(atoms.size() - 1).tfactor = 2f; atoms.add(makeAtom(4, "C", "MET")); - atoms.get(atoms.size()-1).tfactor = 3f; + atoms.get(atoms.size() - 1).tfactor = 3f; atoms.add(makeAtom(5, "O", "LYS")); - atoms.get(atoms.size()-1).tfactor = 7f; + atoms.get(atoms.size() - 1).tfactor = 7f; atoms.add(makeAtom(5, "N", "LYS")); - atoms.get(atoms.size()-1).tfactor = 8f; + atoms.get(atoms.size() - 1).tfactor = 8f; atoms.add(makeAtom(5, "CA", "LYS")); - atoms.get(atoms.size()-1).tfactor = 9f; + atoms.get(atoms.size() - 1).tfactor = 9f; atoms.add(makeAtom(6, "O", "LEU")); - atoms.get(atoms.size()-1).tfactor = 4f; + atoms.get(atoms.size() - 1).tfactor = 4f; atoms.add(makeAtom(6, "N", "LEU")); - atoms.get(atoms.size()-1).tfactor = 5f; + atoms.get(atoms.size() - 1).tfactor = 5f; atoms.add(makeAtom(6, "CA", "LEU")); - atoms.get(atoms.size()-1).tfactor = 6f; - + atoms.get(atoms.size() - 1).tfactor = 6f; + /* * make residues including temp factor annotation */ c.makeResidueList(true); - + /* * Verify annotations; note the tempFactor is read from the first atom in * each residue i.e. we expect values 1, 7, 4 for the residues @@ -307,7 +307,7 @@ public class PDBChainTest * Test the method that constructs bonds between successive residues' CA or P * atoms */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testMakeCaBondList() { c.isNa = true; @@ -338,7 +338,7 @@ public class PDBChainTest assertTrue(c.isNa); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testMakeCaBondList_nucleotide() { c.isNa = false; @@ -370,7 +370,7 @@ public class PDBChainTest /** * Test the method that updates atoms with their alignment positions */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testMakeExactMapping() { Vector atoms = new Vector(); diff --git a/test/MCview/PDBfileTest.java b/test/MCview/PDBfileTest.java index 3e24f52..9d7009f 100644 --- a/test/MCview/PDBfileTest.java +++ b/test/MCview/PDBfileTest.java @@ -21,7 +21,7 @@ import org.testng.annotations.Test; public class PDBfileTest { - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testIsRna() { SequenceI seq = new Sequence("Seq1", "CGAU"); @@ -43,7 +43,7 @@ public class PDBfileTest * * @throws IOException */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testParse() throws IOException { /* @@ -120,7 +120,7 @@ public class PDBfileTest * * @throws IOException */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testParse_withAnnotations_noSS() throws IOException { PDBfile pf = new PDBfile(true, false, false, "examples/3W5V.pdb", @@ -178,7 +178,7 @@ public class PDBfileTest * * @throws IOException */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testParse_withJmol_noAnnotations() throws IOException { PDBfile pf = new PDBfile(false, true, false, "examples/3W5V.pdb", @@ -207,7 +207,7 @@ public class PDBfileTest * * @throws IOException */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testParse_withJmolAddAlignmentAnnotations() throws IOException { @@ -264,8 +264,7 @@ public class PDBfileTest * @throws IOException */ - @Test(groups = - { "Functional" }, enabled = false) + @Test(groups = { "Functional" }, enabled = false) public void testParse_withAnnotate3D() throws IOException { // TODO requires a mock for Annotate3D processing @@ -273,6 +272,7 @@ public class PDBfileTest PDBfile pf = new PDBfile(true, true, true, "examples/2GIS.pdb", AppletFormatAdapter.FILE); } + /** * Helper method to extract parsed annotations from the PDBfile * @@ -285,4 +285,4 @@ public class PDBfileTest pf.addAnnotations(al); return al.getAlignmentAnnotation(); } - } +} diff --git a/test/MCview/ResidueTest.java b/test/MCview/ResidueTest.java index bb7f796..6778e50 100644 --- a/test/MCview/ResidueTest.java +++ b/test/MCview/ResidueTest.java @@ -10,7 +10,7 @@ import org.testng.annotations.Test; public class ResidueTest { - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testFindAtom() { Atom a1 = new Atom(1f, 2f, 3f); diff --git a/test/com/stevesoft/pat/RegexWriterTest.java b/test/com/stevesoft/pat/RegexWriterTest.java index d91119d..e5d087e 100644 --- a/test/com/stevesoft/pat/RegexWriterTest.java +++ b/test/com/stevesoft/pat/RegexWriterTest.java @@ -27,8 +27,7 @@ public class RegexWriterTest * @throws Exception */ - @Test(groups = - { "Functional" }, dataProvider = "testWriteParam") + @Test(groups = { "Functional" }, dataProvider = "testWriteParam") void test(String re, String inp) throws IOException { StringWriter sw = new StringWriter(); @@ -78,23 +77,18 @@ public class RegexWriterTest @DataProvider(name = "testWriteParam") public Object[][] regexTestParams() { - return new Object[][] - { - { "s/x/y/", "-----x123456789" }, - { "s/x/y/", "x123456789" }, - { "s/x/y/", "-----x" }, - { "s/x.*?x/y/", ".xx..x..x...x...x....x....x" }, - { "s/x.*x/[$&]/", "--x........x--xx" }, - { "s/x.*x/[$&]/", "--x........x------" }, - { "s/.$/a/m", "bb\nbbb\nbbbb\nbbbbb\nbbbbbb\nbbbbbbbbbbbb" }, - { "s/.$/a/", "123" }, - { "s/.$/a/", "bb\nbbb\nbbbb\nbbbbb\nbbbbbb\nbb" }, - { "s/^./a/", "bb\nbbb\nbbbb\nbbbbb\nbbbbbb\nbb" }, - { "s/$/a/", "bbb" }, - { "s/^/a/", "bbb" }, - { "s/^/a/", "" }, - { "s{.*}{N}", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, - { "s/.{0,7}/y/", "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" }, - { "s/x/$&/", "xxx" } }; + return new Object[][] { { "s/x/y/", "-----x123456789" }, + { "s/x/y/", "x123456789" }, { "s/x/y/", "-----x" }, + { "s/x.*?x/y/", ".xx..x..x...x...x....x....x" }, + { "s/x.*x/[$&]/", "--x........x--xx" }, + { "s/x.*x/[$&]/", "--x........x------" }, + { "s/.$/a/m", "bb\nbbb\nbbbb\nbbbbb\nbbbbbb\nbbbbbbbbbbbb" }, + { "s/.$/a/", "123" }, + { "s/.$/a/", "bb\nbbb\nbbbb\nbbbbb\nbbbbbb\nbb" }, + { "s/^./a/", "bb\nbbb\nbbbb\nbbbbb\nbbbbbb\nbb" }, + { "s/$/a/", "bbb" }, { "s/^/a/", "bbb" }, { "s/^/a/", "" }, + { "s{.*}{N}", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, + { "s/.{0,7}/y/", "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" }, + { "s/x/$&/", "xxx" } }; } } diff --git a/test/jalview/analysis/AAFrequencyTest.java b/test/jalview/analysis/AAFrequencyTest.java index 77d592a..828cc76 100644 --- a/test/jalview/analysis/AAFrequencyTest.java +++ b/test/jalview/analysis/AAFrequencyTest.java @@ -1,5 +1,5 @@ - package jalview.analysis; + import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertNull; @@ -22,17 +22,16 @@ public class AAFrequencyTest private static final String P = AAFrequency.PROFILE; - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testCalculate_noProfile() { SequenceI seq1 = new Sequence("Seq1", "CAGT"); SequenceI seq2 = new Sequence("Seq2", "CACT"); SequenceI seq3 = new Sequence("Seq3", "C--G"); SequenceI seq4 = new Sequence("Seq4", "CA-t"); - SequenceI[] seqs = new SequenceI[] - { seq1, seq2, seq3, seq4 }; + SequenceI[] seqs = new SequenceI[] { seq1, seq2, seq3, seq4 }; Hashtable[] result = new Hashtable[seq1.getLength()]; - + AAFrequency.calculate(seqs, 0, seq1.getLength(), result, false); // col 0 is 100% C @@ -65,15 +64,14 @@ public class AAFrequencyTest assertEquals("T", col.get(R)); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testCalculate_withProfile() { SequenceI seq1 = new Sequence("Seq1", "CAGT"); SequenceI seq2 = new Sequence("Seq2", "CACT"); SequenceI seq3 = new Sequence("Seq3", "C--G"); SequenceI seq4 = new Sequence("Seq4", "CA-t"); - SequenceI[] seqs = new SequenceI[] - { seq1, seq2, seq3, seq4 }; + SequenceI[] seqs = new SequenceI[] { seq1, seq2, seq3, seq4 }; Hashtable[] result = new Hashtable[seq1.getLength()]; AAFrequency.calculate(seqs, 0, seq1.getLength(), result, true); @@ -100,15 +98,14 @@ public class AAFrequencyTest assertEquals(4, profile[1][1]); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testCalculate_withProfileTiming() { SequenceI seq1 = new Sequence("Seq1", "CAGT"); SequenceI seq2 = new Sequence("Seq2", "CACT"); SequenceI seq3 = new Sequence("Seq3", "C--G"); SequenceI seq4 = new Sequence("Seq4", "CA-t"); - SequenceI[] seqs = new SequenceI[] - { seq1, seq2, seq3, seq4 }; + SequenceI[] seqs = new SequenceI[] { seq1, seq2, seq3, seq4 }; Hashtable[] result = new Hashtable[seq1.getLength()]; // ensure class loaded and initialized @@ -122,7 +119,7 @@ public class AAFrequencyTest System.out.println(System.currentTimeMillis() - start); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetPercentageFormat() { assertNull(AAFrequency.getPercentageFormat(0)); diff --git a/test/jalview/analysis/AlignSeqTest.java b/test/jalview/analysis/AlignSeqTest.java index 34ae612..d3f4bff 100644 --- a/test/jalview/analysis/AlignSeqTest.java +++ b/test/jalview/analysis/AlignSeqTest.java @@ -7,7 +7,7 @@ import org.testng.annotations.Test; public class AlignSeqTest { - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testExtractGaps() { assertNull(AlignSeq.extractGaps(null, null)); diff --git a/test/jalview/analysis/AlignmentAnnotationUtilsTest.java b/test/jalview/analysis/AlignmentAnnotationUtilsTest.java index b68842a..7ba09e9 100644 --- a/test/jalview/analysis/AlignmentAnnotationUtilsTest.java +++ b/test/jalview/analysis/AlignmentAnnotationUtilsTest.java @@ -45,14 +45,14 @@ public class AlignmentAnnotationUtilsTest /** * Test method that converts a (possibly null) array to a list. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testAsList() { // null array Collection c1 = AlignmentAnnotationUtils .asList(null); assertTrue(c1.isEmpty()); - + // empty array AlignmentAnnotation[] anns = new AlignmentAnnotation[0]; c1 = AlignmentAnnotationUtils.asList(anns); @@ -118,12 +118,12 @@ public class AlignmentAnnotationUtilsTest * * @throws IOException */ - @BeforeMethod(alwaysRun = true) + @BeforeMethod(alwaysRun = true) public void setUp() throws IOException { alignment = new jalview.io.FormatAdapter().readFile(TEST_DATA, AppletFormatAdapter.PASTE, "FASTA"); - + AlignmentAnnotation[] anns = new AlignmentAnnotation[SEQ_ANN_COUNT]; for (int i = 0; i < anns.length; i++) { @@ -132,8 +132,7 @@ public class AlignmentAnnotationUtilsTest * array) */ anns[i] = new AlignmentAnnotation("Label" + i, "Desc " + i, - new Annotation[] - {}); + new Annotation[] {}); anns[i].setCalcId("CalcId" + i); anns[i].visible = true; alignment.addAnnotation(anns[i]); @@ -143,14 +142,14 @@ public class AlignmentAnnotationUtilsTest /** * Test a mixture of show/hidden annotations in/outside selection group. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetShownHiddenTypes_forSelectionGroup() { Map>> shownTypes = new HashMap>>(); Map>> hiddenTypes = new HashMap>>(); AlignmentAnnotation[] anns = alignment.getAlignmentAnnotation(); SequenceI[] seqs = alignment.getSequencesArray(); - + /* * Configure annotation properties for test */ @@ -160,7 +159,7 @@ public class AlignmentAnnotationUtilsTest anns[4].visible = false; anns[7].sequenceRef = seqs[1]; anns[7].visible = true; - + /* * in selection group, hidden: */ @@ -184,12 +183,11 @@ public class AlignmentAnnotationUtilsTest anns[6].visible = true; anns[9].sequenceRef = seqs[3]; // CalcId9/Label9 anns[9].visible = true; - + List selected = selectSequences(0, 3); AlignmentAnnotationUtils.getShownHiddenTypes(shownTypes, hiddenTypes, - AlignmentAnnotationUtils.asList(anns), - selected); - + AlignmentAnnotationUtils.asList(anns), selected); + // check results; note CalcId9/Label9 is both hidden and shown (for // different sequences) so should be in both // shown: CalcId6/Label6 and CalcId9/Label9 @@ -200,7 +198,7 @@ public class AlignmentAnnotationUtilsTest assertEquals(1, shownTypes.get("CalcId9").size()); assertEquals(1, shownTypes.get("CalcId9").get(0).size()); assertEquals("Label9", shownTypes.get("CalcId9").get(0).get(0)); - + // hidden: CalcId2/Label2, CalcId2/Label3, CalcId3/Label2, CalcId9/Label9 assertEquals(3, hiddenTypes.size()); assertEquals(2, hiddenTypes.get("CalcId2").size()); @@ -214,7 +212,7 @@ public class AlignmentAnnotationUtilsTest assertEquals(1, hiddenTypes.get("CalcId9").size()); assertEquals(1, hiddenTypes.get("CalcId9").get(0).size()); assertEquals("Label9", hiddenTypes.get("CalcId9").get(0).get(0)); - + consoleDebug(shownTypes, hiddenTypes); } @@ -222,19 +220,19 @@ public class AlignmentAnnotationUtilsTest * Test case where there are 'grouped' annotations, visible and hidden, within * and without the selection group. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetShownHiddenTypes_withGraphGroups() { final int GROUP_3 = 3; final int GROUP_4 = 4; final int GROUP_5 = 5; final int GROUP_6 = 6; - + Map>> shownTypes = new HashMap>>(); Map>> hiddenTypes = new HashMap>>(); AlignmentAnnotation[] anns = alignment.getAlignmentAnnotation(); SequenceI[] seqs = alignment.getSequencesArray(); - + /* * Annotations for selection group and graph group * @@ -263,7 +261,7 @@ public class AlignmentAnnotationUtilsTest anns[11].graphGroup = GROUP_3; anns[11].label = "Label2"; anns[11].setCalcId("CalcId2"); - + // annotations Label1 (hidden), Label5 (visible) in group 6 (visible) anns[1].sequenceRef = seqs[3]; // being in a visible group should take precedence over this visibility @@ -293,7 +291,7 @@ public class AlignmentAnnotationUtilsTest anns[0].graphGroup = GROUP_4; anns[0].label = "Label5"; anns[0].setCalcId("CalcId1"); - + /* * Annotations outwith selection group - should be ignored. */ @@ -316,7 +314,7 @@ public class AlignmentAnnotationUtilsTest anns[9].visible = true; anns[9].graph = AlignmentAnnotation.LINE_GRAPH; anns[9].graphGroup = GROUP_4; - + /* * Generate annotations[] arrays to match aligned columns */ @@ -324,11 +322,10 @@ public class AlignmentAnnotationUtilsTest List selected = selectSequences(0, 3); AlignmentAnnotationUtils.getShownHiddenTypes(shownTypes, hiddenTypes, - AlignmentAnnotationUtils.asList(anns), - selected); - + AlignmentAnnotationUtils.asList(anns), selected); + consoleDebug(shownTypes, hiddenTypes); - + // CalcId1 / Label1, Label5 (only) should be 'shown', once, as a compound // type assertEquals(1, shownTypes.size()); @@ -336,7 +333,7 @@ public class AlignmentAnnotationUtilsTest assertEquals(2, shownTypes.get("CalcId1").get(0).size()); assertEquals("Label1", shownTypes.get("CalcId1").get(0).get(0)); assertEquals("Label5", shownTypes.get("CalcId1").get(0).get(1)); - + // CalcId2 / Label2, Label3 (only) should be 'hidden' assertEquals(1, hiddenTypes.size()); assertEquals(1, hiddenTypes.get("CalcId2").size()); @@ -348,7 +345,7 @@ public class AlignmentAnnotationUtilsTest /** * Test method that determines visible graph groups. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetVisibleGraphGroups() { AlignmentAnnotation[] anns = alignment.getAlignmentAnnotation(); @@ -358,7 +355,7 @@ public class AlignmentAnnotationUtilsTest anns[0].graph = AlignmentAnnotation.BAR_GRAPH; anns[0].graphGroup = 1; anns[0].visible = true; - + /* * a line graph group is included as long as one of its members is visible */ @@ -368,19 +365,19 @@ public class AlignmentAnnotationUtilsTest anns[2].graph = AlignmentAnnotation.LINE_GRAPH; anns[2].graphGroup = 5; anns[2].visible = true; - + /* * a line graph group with no visible rows is not included */ anns[3].graph = AlignmentAnnotation.LINE_GRAPH; anns[3].graphGroup = 3; anns[3].visible = false; - + // a visible line graph with no graph group is not included anns[4].graph = AlignmentAnnotation.LINE_GRAPH; anns[4].graphGroup = -1; anns[4].visible = true; - + BitSet result = AlignmentAnnotationUtils .getVisibleLineGraphGroups(AlignmentAnnotationUtils .asList(anns)); @@ -395,7 +392,7 @@ public class AlignmentAnnotationUtilsTest * Test for case where no sequence is selected. Shouldn't normally arise but * check it handles it gracefully. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetShownHiddenTypes_noSequenceSelected() { Map>> shownTypes = new HashMap>>(); diff --git a/test/jalview/analysis/AlignmentUtilsTests.java b/test/jalview/analysis/AlignmentUtilsTests.java index d789cf2..2beacfe 100644 --- a/test/jalview/analysis/AlignmentUtilsTests.java +++ b/test/jalview/analysis/AlignmentUtilsTests.java @@ -20,7 +20,6 @@ */ package jalview.analysis; - import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertFalse; import static org.testng.AssertJUnit.assertNull; @@ -96,17 +95,18 @@ public class AlignmentUtilsTests public static Sequence ts = new Sequence("short", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklm"); - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testExpandContext() { AlignmentI al = new Alignment(new Sequence[] {}); for (int i = 4; i < 14; i += 2) { - SequenceI s1=ts.deriveSequence().getSubSequence(i, i+7); + SequenceI s1 = ts.deriveSequence().getSubSequence(i, i + 7); al.addSequence(s1); } - System.out.println(new AppletFormatAdapter().formatSequences("Clustal", al, true)); - for (int flnk=-1;flnk<25; flnk++) + System.out.println(new AppletFormatAdapter().formatSequences("Clustal", + al, true)); + for (int flnk = -1; flnk < 25; flnk++) { AlignmentI exp = AlignmentUtils.expandContext(al, flnk); System.out.println("\nFlank size: " + flnk); @@ -150,11 +150,10 @@ public class AlignmentUtilsTests /** * Test that annotations are correctly adjusted by expandContext */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testExpandContext_annotation() { - AlignmentI al = new Alignment(new Sequence[] - {}); + AlignmentI al = new Alignment(new Sequence[] {}); SequenceI ds = new Sequence("Seq1", "ABCDEFGHI"); // subsequence DEF: SequenceI seq1 = ds.deriveSequence().getSubSequence(3, 6); @@ -163,8 +162,8 @@ public class AlignmentUtilsTests /* * Annotate DEF with 4/5/6 respectively */ - Annotation[] anns = new Annotation[] - { new Annotation(4), new Annotation(5), new Annotation(6) }; + Annotation[] anns = new Annotation[] { new Annotation(4), + new Annotation(5), new Annotation(6) }; AlignmentAnnotation ann = new AlignmentAnnotation("SS", "secondary structure", anns); seq1.addAlignmentAnnotation(ann); @@ -240,7 +239,7 @@ public class AlignmentUtilsTests * * @throws IOException */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetSequencesByName() throws IOException { final String data = ">Seq1Name\nKQYL\n" + ">Seq2Name\nRFPW\n" @@ -255,22 +254,25 @@ public class AlignmentUtilsTests assertEquals(1, map.get("Seq2Name").size()); assertEquals("RFPW", map.get("Seq2Name").get(0).getSequenceAsString()); } + /** * Helper method to load an alignment and ensure dataset sequences are set up. * * @param data - * @param format TODO + * @param format + * TODO * @return * @throws IOException */ - protected AlignmentI loadAlignment(final String data, String format) throws IOException + protected AlignmentI loadAlignment(final String data, String format) + throws IOException { AlignmentI a = new FormatAdapter().readFile(data, AppletFormatAdapter.PASTE, format); a.setDataset(null); return a; } - + /** * Test mapping of protein to cDNA, for the case where we have no sequence * cross-references, so mappings are made first-served 1-1 where sequences @@ -278,7 +280,7 @@ public class AlignmentUtilsTests * * @throws IOException */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testMapProteinToCdna_noXrefs() throws IOException { List protseqs = new ArrayList(); @@ -305,8 +307,8 @@ public class AlignmentUtilsTests assertEquals(1, protein.getCodonFrame(protein.getSequenceAt(2)).size()); // V12345 mapped to A22222 - AlignedCodonFrame acf = protein.getCodonFrame( - protein.getSequenceAt(0)).get(0); + AlignedCodonFrame acf = protein.getCodonFrame(protein.getSequenceAt(0)) + .get(0); assertEquals(1, acf.getdnaSeqs().length); assertEquals(cdna.getSequenceAt(1).getDatasetSequence(), acf.getdnaSeqs()[0]); @@ -315,11 +317,11 @@ public class AlignmentUtilsTests MapList mapList = protMappings[0].getMap(); assertEquals(3, mapList.getFromRatio()); assertEquals(1, mapList.getToRatio()); - assertTrue(Arrays.equals(new int[] - { 1, 9 }, mapList.getFromRanges().get(0))); + assertTrue(Arrays.equals(new int[] { 1, 9 }, mapList.getFromRanges() + .get(0))); assertEquals(1, mapList.getFromRanges().size()); - assertTrue(Arrays.equals(new int[] - { 1, 3 }, mapList.getToRanges().get(0))); + assertTrue(Arrays.equals(new int[] { 1, 3 }, + mapList.getToRanges().get(0))); assertEquals(1, mapList.getToRanges().size()); // V12346 mapped to A33333 @@ -341,12 +343,10 @@ public class AlignmentUtilsTests /** * Test for the alignSequenceAs method that takes two sequences and a mapping. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testAlignSequenceAs_withMapping_noIntrons() { - MapList map = new MapList(new int[] - { 1, 6 }, new int[] - { 1, 2 }, 3, 1); + MapList map = new MapList(new int[] { 1, 6 }, new int[] { 1, 2 }, 3, 1); /* * No existing gaps in dna: @@ -387,15 +387,14 @@ public class AlignmentUtilsTests /** * Test for the alignSequenceAs method that takes two sequences and a mapping. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testAlignSequenceAs_withMapping_withIntrons() { /* * Exons at codon 2 (AAA) and 4 (TTT) */ - MapList map = new MapList(new int[] - { 4, 6, 10, 12 }, new int[] - { 1, 2 }, 3, 1); + MapList map = new MapList(new int[] { 4, 6, 10, 12 }, + new int[] { 1, 2 }, 3, 1); /* * Simple case: no gaps in dna @@ -437,24 +436,22 @@ public class AlignmentUtilsTests /** * Test for the case where not all of the protein sequence is mapped to cDNA. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testAlignSequenceAs_withMapping_withUnmappedProtein() { - + /* * Exons at codon 2 (AAA) and 4 (TTT) mapped to A and P */ - final MapList map = new MapList(new int[] - { 4, 6, 10, 12 }, new int[] - { 1, 1, 3, 3 }, 3, 1); - + final MapList map = new MapList(new int[] { 4, 6, 10, 12 }, new int[] { + 1, 1, 3, 3 }, 3, 1); /* * Expect alignment does nothing (aborts realignment). Change this test * first if different behaviour wanted. */ - checkAlignSequenceAs("GGGAAACCCTTTGGG", "-A-L-P-", false, - false, map, "GGGAAACCCTTTGGG"); + checkAlignSequenceAs("GGGAAACCCTTTGGG", "-A-L-P-", false, false, map, + "GGGAAACCCTTTGGG"); } /** @@ -487,26 +484,24 @@ public class AlignmentUtilsTests /** * Test for the alignSequenceAs method where we preserve gaps in introns only. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testAlignSequenceAs_keepIntronGapsOnly() { /* * Intron GGGAAA followed by exon CCCTTT */ - MapList map = new MapList(new int[] - { 7, 12 }, new int[] - { 1, 2 }, 3, 1); - - checkAlignSequenceAs("GG-G-AA-A-C-CC-T-TT", "AL", - false, true, map, "GG-G-AA-ACCCTTT"); + MapList map = new MapList(new int[] { 7, 12 }, new int[] { 1, 2 }, 3, 1); + + checkAlignSequenceAs("GG-G-AA-A-C-CC-T-TT", "AL", false, true, map, + "GG-G-AA-ACCCTTT"); } /** * Test for the method that generates an aligned translated sequence from one * mapping. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetAlignedTranslation_dnaLikeProtein() { // dna alignment will be replaced @@ -515,22 +510,21 @@ public class AlignmentUtilsTests // protein alignment will be 'applied' to dna SequenceI protein = new Sequence("Seq1", "-CH-Y--Q-"); protein.createDatasetSequence(); - MapList map = new MapList(new int[] - { 1, 12 }, new int[] - { 1, 4 }, 3, 1); + MapList map = new MapList(new int[] { 1, 12 }, new int[] { 1, 4 }, 3, 1); AlignedCodonFrame acf = new AlignedCodonFrame(); acf.addMap(dna.getDatasetSequence(), protein.getDatasetSequence(), map); - final SequenceI aligned = AlignmentUtils - .getAlignedTranslation(protein, '-', acf); - assertEquals("---TGCCAT---TAC------CAG---", aligned.getSequenceAsString()); + final SequenceI aligned = AlignmentUtils.getAlignedTranslation(protein, + '-', acf); + assertEquals("---TGCCAT---TAC------CAG---", + aligned.getSequenceAsString()); assertSame(aligned.getDatasetSequence(), dna.getDatasetSequence()); } /** * Test the method that realigns protein to match mapped codon alignment. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testAlignProteinAsDna() { // seq1 codons are [1,2,3] [4,5,6] [7,8,9] [10,11,12] @@ -539,8 +533,7 @@ public class AlignmentUtilsTests SequenceI dna2 = new Sequence("Seq2", "T-GCCATTACCAG"); // seq3 codons are [1,2,3] [4,5,7] [8,9,10] [11,12,13] SequenceI dna3 = new Sequence("Seq3", "TGCCA-TTACCAG"); - AlignmentI dna = new Alignment(new SequenceI[] - { dna1, dna2, dna3 }); + AlignmentI dna = new Alignment(new SequenceI[] { dna1, dna2, dna3 }); dna.setDataset(null); // protein alignment will be realigned like dna @@ -548,14 +541,11 @@ public class AlignmentUtilsTests SequenceI prot2 = new Sequence("Seq2", "CHYQ"); SequenceI prot3 = new Sequence("Seq3", "CHYQ"); SequenceI prot4 = new Sequence("Seq4", "R-QSV"); // unmapped, unchanged - AlignmentI protein = new Alignment(new SequenceI[] - { prot1, prot2, + AlignmentI protein = new Alignment(new SequenceI[] { prot1, prot2, prot3, prot4 }); protein.setDataset(null); - MapList map = new MapList(new int[] - { 1, 12 }, new int[] - { 1, 4 }, 3, 1); + MapList map = new MapList(new int[] { 1, 12 }, new int[] { 1, 4 }, 3, 1); AlignedCodonFrame acf = new AlignedCodonFrame(); acf.addMap(dna1.getDatasetSequence(), prot1.getDatasetSequence(), map); acf.addMap(dna2.getDatasetSequence(), prot2.getDatasetSequence(), map); @@ -577,7 +567,7 @@ public class AlignmentUtilsTests * Test the method that tests whether a CDNA sequence translates to a protein * sequence */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testTranslatesAs() { assertTrue(AlignmentUtils.translatesAs("tttcccaaaggg".toCharArray(), 0, @@ -617,8 +607,7 @@ public class AlignmentUtilsTests // wrong protein assertFalse(AlignmentUtils.translatesAs("tttcccaaaggg".toCharArray(), - 0, - "FPMG".toCharArray())); + 0, "FPMG".toCharArray())); } /** @@ -627,7 +616,7 @@ public class AlignmentUtilsTests * * @throws IOException */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testMapProteinToCdna_withStartAndStopCodons() throws IOException { @@ -637,7 +626,7 @@ public class AlignmentUtilsTests protseqs.add(new Sequence("UNIPROT|V12347", "SAR")); AlignmentI protein = new Alignment(protseqs.toArray(new SequenceI[3])); protein.setDataset(null); - + List dnaseqs = new ArrayList(); // start + SAR: dnaseqs.add(new Sequence("EMBL|A11111", "ATGTCAGCACGC")); @@ -648,7 +637,7 @@ public class AlignmentUtilsTests dnaseqs.add(new Sequence("EMBL|A44444", "GAAATTCAG")); AlignmentI cdna = new Alignment(dnaseqs.toArray(new SequenceI[4])); cdna.setDataset(null); - + assertTrue(AlignmentUtils.mapProteinToCdna(protein, cdna)); // 3 mappings made, each from 1 to 1 sequence @@ -656,10 +645,10 @@ public class AlignmentUtilsTests assertEquals(1, protein.getCodonFrame(protein.getSequenceAt(0)).size()); assertEquals(1, protein.getCodonFrame(protein.getSequenceAt(1)).size()); assertEquals(1, protein.getCodonFrame(protein.getSequenceAt(2)).size()); - + // V12345 mapped from A22222 - AlignedCodonFrame acf = protein.getCodonFrame( - protein.getSequenceAt(0)).get(0); + AlignedCodonFrame acf = protein.getCodonFrame(protein.getSequenceAt(0)) + .get(0); assertEquals(1, acf.getdnaSeqs().length); assertEquals(cdna.getSequenceAt(1).getDatasetSequence(), acf.getdnaSeqs()[0]); @@ -668,11 +657,11 @@ public class AlignmentUtilsTests MapList mapList = protMappings[0].getMap(); assertEquals(3, mapList.getFromRatio()); assertEquals(1, mapList.getToRatio()); - assertTrue(Arrays.equals(new int[] - { 1, 9 }, mapList.getFromRanges().get(0))); + assertTrue(Arrays.equals(new int[] { 1, 9 }, mapList.getFromRanges() + .get(0))); assertEquals(1, mapList.getFromRanges().size()); - assertTrue(Arrays.equals(new int[] - { 1, 3 }, mapList.getToRanges().get(0))); + assertTrue(Arrays.equals(new int[] { 1, 3 }, + mapList.getToRanges().get(0))); assertEquals(1, mapList.getToRanges().size()); // V12346 mapped from A33333 starting position 4 @@ -685,13 +674,13 @@ public class AlignmentUtilsTests mapList = protMappings[0].getMap(); assertEquals(3, mapList.getFromRatio()); assertEquals(1, mapList.getToRatio()); - assertTrue(Arrays.equals(new int[] - { 4, 12 }, mapList.getFromRanges().get(0))); + assertTrue(Arrays.equals(new int[] { 4, 12 }, mapList.getFromRanges() + .get(0))); assertEquals(1, mapList.getFromRanges().size()); - assertTrue(Arrays.equals(new int[] - { 1, 3 }, mapList.getToRanges().get(0))); + assertTrue(Arrays.equals(new int[] { 1, 3 }, + mapList.getToRanges().get(0))); assertEquals(1, mapList.getToRanges().size()); - + // V12347 mapped to A11111 starting position 4 acf = protein.getCodonFrame(protein.getSequenceAt(2)).get(0); assertEquals(1, acf.getdnaSeqs().length); @@ -702,13 +691,13 @@ public class AlignmentUtilsTests mapList = protMappings[0].getMap(); assertEquals(3, mapList.getFromRatio()); assertEquals(1, mapList.getToRatio()); - assertTrue(Arrays.equals(new int[] - { 4, 12 }, mapList.getFromRanges().get(0))); + assertTrue(Arrays.equals(new int[] { 4, 12 }, mapList.getFromRanges() + .get(0))); assertEquals(1, mapList.getFromRanges().size()); - assertTrue(Arrays.equals(new int[] - { 1, 3 }, mapList.getToRanges().get(0))); + assertTrue(Arrays.equals(new int[] { 1, 3 }, + mapList.getToRanges().get(0))); assertEquals(1, mapList.getToRanges().size()); - + // no mapping involving the 'extra' A44444 assertTrue(protein.getCodonFrame(cdna.getSequenceAt(3)).isEmpty()); } @@ -720,7 +709,7 @@ public class AlignmentUtilsTests * * @throws IOException */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testMapProteinToCdna_withXrefs() throws IOException { List protseqs = new ArrayList(); @@ -729,7 +718,7 @@ public class AlignmentUtilsTests protseqs.add(new Sequence("UNIPROT|V12347", "SAR")); AlignmentI protein = new Alignment(protseqs.toArray(new SequenceI[3])); protein.setDataset(null); - + List dnaseqs = new ArrayList(); dnaseqs.add(new Sequence("EMBL|A11111", "TCAGCACGC")); // = SAR dnaseqs.add(new Sequence("EMBL|A22222", "ATGGAGATACAA")); // = start + EIQ @@ -738,7 +727,7 @@ public class AlignmentUtilsTests dnaseqs.add(new Sequence("EMBL|A55555", "GAGATTCAG")); // = EIQ AlignmentI cdna = new Alignment(dnaseqs.toArray(new SequenceI[5])); cdna.setDataset(null); - + // Xref A22222 to V12345 (should get mapped) dnaseqs.get(1).addDBRef(new DBRefEntry("UNIPROT", "1", "V12345")); // Xref V12345 to A44444 (should get mapped) @@ -763,28 +752,28 @@ public class AlignmentUtilsTests assertEquals(1, protein.getCodonFrame(cdna.getSequenceAt(1)).size()); assertEquals(1, protein.getCodonFrame(cdna.getSequenceAt(2)).size()); assertEquals(1, protein.getCodonFrame(cdna.getSequenceAt(3)).size()); - + // V12345 mapped to A22222 and A44444 - AlignedCodonFrame acf = protein.getCodonFrame( - protein.getSequenceAt(0)).get(0); + AlignedCodonFrame acf = protein.getCodonFrame(protein.getSequenceAt(0)) + .get(0); assertEquals(2, acf.getdnaSeqs().length); assertEquals(cdna.getSequenceAt(1).getDatasetSequence(), acf.getdnaSeqs()[0]); assertEquals(cdna.getSequenceAt(3).getDatasetSequence(), acf.getdnaSeqs()[1]); - + // V12346 mapped to A33333 acf = protein.getCodonFrame(protein.getSequenceAt(1)).get(0); assertEquals(1, acf.getdnaSeqs().length); assertEquals(cdna.getSequenceAt(2).getDatasetSequence(), acf.getdnaSeqs()[0]); - + // V12347 mapped to A11111 acf = protein.getCodonFrame(protein.getSequenceAt(2)).get(0); assertEquals(1, acf.getdnaSeqs().length); assertEquals(cdna.getSequenceAt(0).getDatasetSequence(), acf.getdnaSeqs()[0]); - + // no mapping involving the 'extra' A55555 assertTrue(protein.getCodonFrame(cdna.getSequenceAt(4)).isEmpty()); } @@ -796,7 +785,7 @@ public class AlignmentUtilsTests * * @throws IOException */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testMapProteinToCdna_prioritiseXrefs() throws IOException { List protseqs = new ArrayList(); @@ -805,36 +794,36 @@ public class AlignmentUtilsTests AlignmentI protein = new Alignment( protseqs.toArray(new SequenceI[protseqs.size()])); protein.setDataset(null); - + List dnaseqs = new ArrayList(); dnaseqs.add(new Sequence("EMBL|A11111", "GAAATCCAG")); // = EIQ dnaseqs.add(new Sequence("EMBL|A22222", "GAAATTCAG")); // = EIQ AlignmentI cdna = new Alignment(dnaseqs.toArray(new SequenceI[dnaseqs .size()])); cdna.setDataset(null); - + // Xref A22222 to V12345 (should get mapped) // A11111 should then be mapped to the unmapped V12346 dnaseqs.get(1).addDBRef(new DBRefEntry("UNIPROT", "1", "V12345")); - + assertTrue(AlignmentUtils.mapProteinToCdna(protein, cdna)); - + // 2 protein mappings made assertEquals(2, protein.getCodonFrames().size()); assertEquals(1, protein.getCodonFrame(protein.getSequenceAt(0)).size()); assertEquals(1, protein.getCodonFrame(protein.getSequenceAt(1)).size()); - + // one mapping for each of the cDNA sequences assertEquals(1, protein.getCodonFrame(cdna.getSequenceAt(0)).size()); assertEquals(1, protein.getCodonFrame(cdna.getSequenceAt(1)).size()); - + // V12345 mapped to A22222 AlignedCodonFrame acf = protein.getCodonFrame(protein.getSequenceAt(0)) .get(0); assertEquals(1, acf.getdnaSeqs().length); assertEquals(cdna.getSequenceAt(1).getDatasetSequence(), acf.getdnaSeqs()[0]); - + // V12346 mapped to A11111 acf = protein.getCodonFrame(protein.getSequenceAt(1)).get(0); assertEquals(1, acf.getdnaSeqs().length); @@ -846,14 +835,13 @@ public class AlignmentUtilsTests * Test the method that shows or hides sequence annotations by type(s) and * selection group. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testShowOrHideSequenceAnnotations() { SequenceI seq1 = new Sequence("Seq1", "AAA"); SequenceI seq2 = new Sequence("Seq2", "BBB"); SequenceI seq3 = new Sequence("Seq3", "CCC"); - Annotation[] anns = new Annotation[] - { new Annotation(2f) }; + Annotation[] anns = new Annotation[] { new Annotation(2f) }; AlignmentAnnotation ann1 = new AlignmentAnnotation("Structure", "ann1", anns); ann1.setSequenceRef(seq1); @@ -867,7 +855,7 @@ public class AlignmentUtilsTests AlignmentAnnotation ann5 = new AlignmentAnnotation("Temp", "ann5", anns); ann5.setSequenceRef(seq2); AlignmentAnnotation ann6 = new AlignmentAnnotation("Temp", "ann6", anns); - AlignmentI al = new Alignment(new SequenceI[] {seq1, seq2, seq3}); + AlignmentI al = new Alignment(new SequenceI[] { seq1, seq2, seq3 }); al.addAnnotation(ann1); // Structure for Seq1 al.addAnnotation(ann2); // Structure for Seq2 al.addAnnotation(ann3); // Structure for no sequence @@ -954,7 +942,7 @@ public class AlignmentUtilsTests /** * Tests for the method that checks if one sequence cross-references another */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testHasCrossRef() { assertFalse(AlignmentUtils.hasCrossRef(null, null)); @@ -963,15 +951,15 @@ public class AlignmentUtilsTests assertFalse(AlignmentUtils.hasCrossRef(null, seq1)); SequenceI seq2 = new Sequence("UNIPROT|V20192", "ABCDEF"); assertFalse(AlignmentUtils.hasCrossRef(seq1, seq2)); - + // different ref seq1.addDBRef(new DBRefEntry("UNIPROT", "1", "v20193")); assertFalse(AlignmentUtils.hasCrossRef(seq1, seq2)); - + // case-insensitive; version number is ignored seq1.addDBRef(new DBRefEntry("UNIPROT", "1", "v20192")); assertTrue(AlignmentUtils.hasCrossRef(seq1, seq2)); - + // right case! seq1.addDBRef(new DBRefEntry("UNIPROT", "1", "V20192")); assertTrue(AlignmentUtils.hasCrossRef(seq1, seq2)); @@ -983,7 +971,7 @@ public class AlignmentUtilsTests * Tests for the method that checks if either sequence cross-references the * other */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testHaveCrossRef() { assertFalse(AlignmentUtils.hasCrossRef(null, null)); @@ -992,18 +980,18 @@ public class AlignmentUtilsTests assertFalse(AlignmentUtils.haveCrossRef(null, seq1)); SequenceI seq2 = new Sequence("UNIPROT|V20192", "ABCDEF"); assertFalse(AlignmentUtils.haveCrossRef(seq1, seq2)); - + seq1.addDBRef(new DBRefEntry("UNIPROT", "1", "V20192")); assertTrue(AlignmentUtils.haveCrossRef(seq1, seq2)); // next is true for haveCrossRef, false for hasCrossRef assertTrue(AlignmentUtils.haveCrossRef(seq2, seq1)); - + // now the other way round seq1.setDBRef(null); seq2.addDBRef(new DBRefEntry("EMBL", "1", "A12345")); assertTrue(AlignmentUtils.haveCrossRef(seq1, seq2)); assertTrue(AlignmentUtils.haveCrossRef(seq2, seq1)); - + // now both ways seq1.addDBRef(new DBRefEntry("UNIPROT", "1", "V20192")); assertTrue(AlignmentUtils.haveCrossRef(seq1, seq2)); @@ -1013,7 +1001,7 @@ public class AlignmentUtilsTests /** * Test the method that extracts the exon-only part of a dna alignment. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testMakeExonAlignment() { SequenceI dna1 = new Sequence("dna1", "aaaGGGcccTTTaaa"); @@ -1026,21 +1014,19 @@ public class AlignmentUtilsTests pep2.createDatasetSequence(); Set mappings = new HashSet(); - MapList map = new MapList(new int[] - { 4, 6, 10, 12 }, new int[] - { 1, 2 }, 3, 1); + MapList map = new MapList(new int[] { 4, 6, 10, 12 }, + new int[] { 1, 2 }, 3, 1); AlignedCodonFrame acf = new AlignedCodonFrame(); acf.addMap(dna1.getDatasetSequence(), pep1.getDatasetSequence(), map); mappings.add(acf); - map = new MapList(new int[] - { 1, 3, 7, 9, 13, 15 }, new int[] - { 1, 3 }, 3, 1); + map = new MapList(new int[] { 1, 3, 7, 9, 13, 15 }, new int[] { 1, 3 }, + 3, 1); acf = new AlignedCodonFrame(); acf.addMap(dna2.getDatasetSequence(), pep2.getDatasetSequence(), map); mappings.add(acf); - - AlignmentI exons = AlignmentUtils.makeExonAlignment(new SequenceI[] - { dna1, dna2 }, mappings); + + AlignmentI exons = AlignmentUtils.makeExonAlignment(new SequenceI[] { + dna1, dna2 }, mappings); assertEquals(2, exons.getSequences().size()); assertEquals("GGGTTT", exons.getSequenceAt(0).getSequenceAsString()); assertEquals("GGGTTTCCC", exons.getSequenceAt(1).getSequenceAsString()); @@ -1108,7 +1094,7 @@ public class AlignmentUtilsTests * already has a protein product (Uniprot translation) which in turn has an * x-ref to the EMBLCDS record. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testMakeExonSequences() { SequenceI dna1 = new Sequence("dna1", "aaaGGGcccTTTaaa"); @@ -1123,9 +1109,8 @@ public class AlignmentUtilsTests * EMBLCDS|A12345. */ Set mappings = new HashSet(); - MapList map = new MapList(new int[] - { 4, 6, 10, 12 }, new int[] - { 1, 2 }, 3, 1); + MapList map = new MapList(new int[] { 4, 6, 10, 12 }, + new int[] { 1, 2 }, 3, 1); AlignedCodonFrame acf = new AlignedCodonFrame(); acf.addMap(dna1.getDatasetSequence(), pep1.getDatasetSequence(), map); mappings.add(acf); @@ -1150,7 +1135,7 @@ public class AlignmentUtilsTests * its product mappings, for the case where there are multiple exon mappings * to different protein products. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testMakeExonAlignment_multipleProteins() { SequenceI dna1 = new Sequence("dna1", "aaaGGGcccTTTaaa"); @@ -1175,25 +1160,20 @@ public class AlignmentUtilsTests */ Set mappings = new LinkedHashSet(); // map ...GGG...TTT to GF - MapList map = new MapList(new int[] - { 4, 6, 10, 12 }, new int[] - { 1, 2 }, 3, 1); + MapList map = new MapList(new int[] { 4, 6, 10, 12 }, + new int[] { 1, 2 }, 3, 1); AlignedCodonFrame acf = new AlignedCodonFrame(); acf.addMap(dna1.getDatasetSequence(), pep1.getDatasetSequence(), map); mappings.add(acf); // map aaa...ccc to KP - map = new MapList(new int[] - { 1, 3, 7, 9 }, new int[] - { 1, 2 }, 3, 1); + map = new MapList(new int[] { 1, 3, 7, 9 }, new int[] { 1, 2 }, 3, 1); acf = new AlignedCodonFrame(); acf.addMap(dna1.getDatasetSequence(), pep2.getDatasetSequence(), map); mappings.add(acf); // map aaa......TTT to KF - map = new MapList(new int[] - { 1, 3, 10, 12 }, new int[] - { 1, 2 }, 3, 1); + map = new MapList(new int[] { 1, 3, 10, 12 }, new int[] { 1, 2 }, 3, 1); acf = new AlignedCodonFrame(); acf.addMap(dna1.getDatasetSequence(), pep3.getDatasetSequence(), map); mappings.add(acf); @@ -1202,8 +1182,8 @@ public class AlignmentUtilsTests * Create the Exon alignment; also replaces the dna-to-protein mappings with * exon-to-protein and exon-to-dna mappings */ - AlignmentI exal = AlignmentUtils.makeExonAlignment(new SequenceI[] - { dna1 }, mappings); + AlignmentI exal = AlignmentUtils.makeExonAlignment( + new SequenceI[] { dna1 }, mappings); /* * Verify we have 3 exon sequences, mapped to pep1/2/3 respectively diff --git a/test/jalview/analysis/AnnotationSorterTest.java b/test/jalview/analysis/AnnotationSorterTest.java index 47271e5..39b10fb 100644 --- a/test/jalview/analysis/AnnotationSorterTest.java +++ b/test/jalview/analysis/AnnotationSorterTest.java @@ -30,7 +30,7 @@ public class AnnotationSorterTest /* * Set up 6 sequences and 7 annotations. */ - @BeforeMethod(alwaysRun = true) + @BeforeMethod(alwaysRun = true) public void setUp() { al = buildAlignment(NUM_SEQS); @@ -84,7 +84,7 @@ public class AnnotationSorterTest * sequence ref * */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testSortBySequenceAndType_autocalcLast() { // @formatter:off @@ -111,7 +111,7 @@ public class AnnotationSorterTest /** * Variant with autocalculated annotations sorting to front */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testSortBySequenceAndType_autocalcFirst() { // @formatter:off @@ -147,7 +147,7 @@ public class AnnotationSorterTest * sequence ref * */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testSortByTypeAndSequence_autocalcLast() { // @formatter:off @@ -174,7 +174,7 @@ public class AnnotationSorterTest /** * Variant of test with autocalculated annotations sorted to front */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testSortByTypeAndSequence_autocalcFirst() { // @formatter:off @@ -202,7 +202,7 @@ public class AnnotationSorterTest * Variant of test with autocalculated annotations sorted to front but * otherwise no change. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testNoSort_autocalcFirst() { // @formatter:off @@ -226,7 +226,7 @@ public class AnnotationSorterTest assertEquals("Structure", anns[6].label); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testSort_timingPresorted() { testTiming_presorted(50, 100); @@ -262,14 +262,14 @@ public class AnnotationSorterTest long endTime = System.currentTimeMillis(); final long elapsed = endTime - startTime; System.out.println("Timing test for presorted " + numSeqs - + " sequences and " - + numAnns + " annotations took " + elapsed + "ms"); + + " sequences and " + numAnns + " annotations took " + elapsed + + "ms"); } /** * Timing tests for sorting randomly sorted annotations for various sizes. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testSort_timingUnsorted() { testTiming_unsorted(50, 100); @@ -306,14 +306,14 @@ public class AnnotationSorterTest long endTime = System.currentTimeMillis(); final long elapsed = endTime - startTime; System.out.println("Timing test for unsorted " + numSeqs - + " sequences and " - + numAnns + " annotations took " + elapsed + "ms"); + + " sequences and " + numAnns + " annotations took " + elapsed + + "ms"); } /** * Timing test for sorting annotations with a limited range of types (labels). */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testSort_timingSemisorted() { testTiming_semiSorted(50, 100); @@ -339,8 +339,8 @@ public class AnnotationSorterTest Alignment alignment = buildAlignment(numSeqs); AlignmentAnnotation[] annotations = buildAnnotations(numAnns); - String[] labels = new String[] - { "label1", "label2", "label3", "label4", "label5", "label6" }; + String[] labels = new String[] { "label1", "label2", "label3", + "label4", "label5", "label6" }; /* * Set the annotations in sequence order with randomly assigned labels. @@ -359,8 +359,8 @@ public class AnnotationSorterTest long endTime = System.currentTimeMillis(); long elapsed = endTime - startTime; System.out.println("Sort by label for semisorted " + numSeqs - + " sequences and " - + numAnns + " annotations took " + elapsed + "ms"); + + " sequences and " + numAnns + " annotations took " + elapsed + + "ms"); // now resort by sequence startTime = System.currentTimeMillis(); diff --git a/test/jalview/analysis/CodingUtilsTest.java b/test/jalview/analysis/CodingUtilsTest.java index 429c9ed..d29be9c 100644 --- a/test/jalview/analysis/CodingUtilsTest.java +++ b/test/jalview/analysis/CodingUtilsTest.java @@ -10,28 +10,28 @@ import org.testng.annotations.Test; public class CodingUtilsTest { - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testDecodeCodon() { - assertTrue(Arrays.equals(new char[] - { 'A', 'A', 'A' }, CodingUtils.decodeCodon(0))); - assertTrue(Arrays.equals(new char[] - { 'A', 'A', 'C' }, CodingUtils.decodeCodon(1))); - assertTrue(Arrays.equals(new char[] - { 'A', 'A', 'G' }, CodingUtils.decodeCodon(2))); - assertTrue(Arrays.equals(new char[] - { 'A', 'A', 'T' }, CodingUtils.decodeCodon(3))); - assertTrue(Arrays.equals(new char[] - { 'A', 'C', 'A' }, CodingUtils.decodeCodon(4))); - assertTrue(Arrays.equals(new char[] - { 'C', 'A', 'A' }, CodingUtils.decodeCodon(16))); - assertTrue(Arrays.equals(new char[] - { 'G', 'G', 'G' }, CodingUtils.decodeCodon(42))); - assertTrue(Arrays.equals(new char[] - { 'T', 'T', 'T' }, CodingUtils.decodeCodon(63))); + assertTrue(Arrays.equals(new char[] { 'A', 'A', 'A' }, + CodingUtils.decodeCodon(0))); + assertTrue(Arrays.equals(new char[] { 'A', 'A', 'C' }, + CodingUtils.decodeCodon(1))); + assertTrue(Arrays.equals(new char[] { 'A', 'A', 'G' }, + CodingUtils.decodeCodon(2))); + assertTrue(Arrays.equals(new char[] { 'A', 'A', 'T' }, + CodingUtils.decodeCodon(3))); + assertTrue(Arrays.equals(new char[] { 'A', 'C', 'A' }, + CodingUtils.decodeCodon(4))); + assertTrue(Arrays.equals(new char[] { 'C', 'A', 'A' }, + CodingUtils.decodeCodon(16))); + assertTrue(Arrays.equals(new char[] { 'G', 'G', 'G' }, + CodingUtils.decodeCodon(42))); + assertTrue(Arrays.equals(new char[] { 'T', 'T', 'T' }, + CodingUtils.decodeCodon(63))); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testDecodeNucleotide() { assertEquals('A', CodingUtils.decodeNucleotide(0)); @@ -41,7 +41,7 @@ public class CodingUtilsTest assertEquals('0', CodingUtils.decodeNucleotide(4)); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testEncodeCodon() { assertTrue(CodingUtils.encodeCodon('Z') < 0); @@ -55,24 +55,16 @@ public class CodingUtilsTest assertEquals(3, CodingUtils.encodeCodon('T')); assertEquals(3, CodingUtils.encodeCodon('u')); assertEquals(3, CodingUtils.encodeCodon('U')); - + assertEquals(-1, CodingUtils.encodeCodon(null)); - assertEquals(0, CodingUtils.encodeCodon(new char[] - { 'A', 'A', 'A' })); - assertEquals(1, CodingUtils.encodeCodon(new char[] - { 'A', 'A', 'C' })); - assertEquals(2, CodingUtils.encodeCodon(new char[] - { 'A', 'A', 'G' })); - assertEquals(3, CodingUtils.encodeCodon(new char[] - { 'A', 'A', 'T' })); - assertEquals(4, CodingUtils.encodeCodon(new char[] - { 'A', 'C', 'A' })); - assertEquals(16, CodingUtils.encodeCodon(new char[] - { 'C', 'A', 'A' })); - assertEquals(42, CodingUtils.encodeCodon(new char[] - { 'G', 'G', 'G' })); - assertEquals(63, CodingUtils.encodeCodon(new char[] - { 'T', 'T', 'T' })); + assertEquals(0, CodingUtils.encodeCodon(new char[] { 'A', 'A', 'A' })); + assertEquals(1, CodingUtils.encodeCodon(new char[] { 'A', 'A', 'C' })); + assertEquals(2, CodingUtils.encodeCodon(new char[] { 'A', 'A', 'G' })); + assertEquals(3, CodingUtils.encodeCodon(new char[] { 'A', 'A', 'T' })); + assertEquals(4, CodingUtils.encodeCodon(new char[] { 'A', 'C', 'A' })); + assertEquals(16, CodingUtils.encodeCodon(new char[] { 'C', 'A', 'A' })); + assertEquals(42, CodingUtils.encodeCodon(new char[] { 'G', 'G', 'G' })); + assertEquals(63, CodingUtils.encodeCodon(new char[] { 'T', 'T', 'T' })); } } diff --git a/test/jalview/analysis/CrossRefTest.java b/test/jalview/analysis/CrossRefTest.java index bd737fa..07f0816 100644 --- a/test/jalview/analysis/CrossRefTest.java +++ b/test/jalview/analysis/CrossRefTest.java @@ -9,7 +9,7 @@ import org.testng.annotations.Test; public class CrossRefTest { - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testFindXDbRefs() { DBRefEntry ref1 = new DBRefEntry("UNIPROT", "1", "A123"); @@ -20,8 +20,8 @@ public class CrossRefTest DBRefEntry ref6 = new DBRefEntry("emblCDS", "1", "A123"); DBRefEntry ref7 = new DBRefEntry("GeneDB", "1", "A123"); DBRefEntry ref8 = new DBRefEntry("PFAM", "1", "A123"); - DBRefEntry[] refs = new DBRefEntry[] - { ref1, ref2, ref3, ref4, ref5, ref6, ref7, ref8 }; + DBRefEntry[] refs = new DBRefEntry[] { ref1, ref2, ref3, ref4, ref5, + ref6, ref7, ref8 }; /* * Just the DNA refs: diff --git a/test/jalview/analysis/DnaAlignmentGenerator.java b/test/jalview/analysis/DnaAlignmentGenerator.java index 1b8964f..e737de1 100644 --- a/test/jalview/analysis/DnaAlignmentGenerator.java +++ b/test/jalview/analysis/DnaAlignmentGenerator.java @@ -34,11 +34,10 @@ public class DnaAlignmentGenerator private static final char ZERO = '0'; - private static final char[] BASES = new char[] - { 'G', 'T', 'C', 'A' }; + private static final char[] BASES = new char[] { 'G', 'T', 'C', 'A' }; private Random random; - + /** * Outputs a DNA 'alignment' where each position is a random choice from * 'GTCA-'. diff --git a/test/jalview/analysis/DnaTest.java b/test/jalview/analysis/DnaTest.java index 765ec2b..aeff465 100644 --- a/test/jalview/analysis/DnaTest.java +++ b/test/jalview/analysis/DnaTest.java @@ -94,7 +94,7 @@ public class DnaTest * * @throws IOException */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testTranslateCdna_withUntranslatableCodons() throws IOException { @@ -103,8 +103,7 @@ public class DnaTest "FASTA"); ColumnSelection cs = new ColumnSelection(); AlignViewportI av = new AlignViewport(alf, cs); - Dna dna = new Dna(av, new int[] - { 0, alf.getWidth() - 1 }); + Dna dna = new Dna(av, new int[] { 0, alf.getWidth() - 1 }); AlignmentI translated = dna.translateCdna(); assertNotNull("Couldn't do a full width translation of test data.", translated); @@ -116,7 +115,7 @@ public class DnaTest * * @throws IOException */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testTranslateCdna_withUntranslatableCodonsAndHiddenColumns() throws IOException { @@ -152,15 +151,14 @@ public class DnaTest * * @throws IOException */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testTranslateCdna_simple() throws IOException { AlignmentI alf = new FormatAdapter().readFile(fasta, FormatAdapter.PASTE, "FASTA"); ColumnSelection cs = new ColumnSelection(); AlignViewportI av = new AlignViewport(alf, cs); - Dna dna = new Dna(av, new int[] - { 0, alf.getWidth() - 1 }); + Dna dna = new Dna(av, new int[] { 0, alf.getWidth() - 1 }); AlignmentI translated = dna.translateCdna(); String aa = translated.getSequenceAt(0).getSequenceAsString(); assertEquals( @@ -173,7 +171,7 @@ public class DnaTest * * @throws IOException */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testTranslateCdna_hiddenColumns() throws IOException { AlignmentI alf = new FormatAdapter().readFile(fasta, @@ -183,8 +181,7 @@ public class DnaTest cs.hideColumns(24, 35); // hide codons 9-12 cs.hideColumns(177, 191); // hide codons 60-64 AlignViewportI av = new AlignViewport(alf, cs); - Dna dna = new Dna(av, new int[] - { 0, alf.getWidth() - 1 }); + Dna dna = new Dna(av, new int[] { 0, alf.getWidth() - 1 }); AlignmentI translated = dna.translateCdna(); String aa = translated.getSequenceAt(0).getSequenceAsString(); assertEquals("AACDDGGGGHHIIIKKLLLLLLMNNPPPPQQRRRRRRSSSSSSTTTTVVVVW", aa); @@ -193,7 +190,7 @@ public class DnaTest /** * Use this test to help debug into any cases of interest. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testCompareCodonPos_oneOnly() { assertFollows("-AA--A", "G--GG"); // 2 shifted seq2, 3 shifted seq1 @@ -202,7 +199,7 @@ public class DnaTest /** * Tests for method that compares 'alignment' of two codon position triplets. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testCompareCodonPos() { /* @@ -259,7 +256,7 @@ public class DnaTest * reorders the cDNA and retranslates, and verifies that the translations are * the same (apart from ordering). */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testTranslateCdna_sequenceOrderIndependent() { /* @@ -268,16 +265,14 @@ public class DnaTest AlignmentI cdna = new DnaAlignmentGenerator().generate(12, 8, 97, 5, 5); ColumnSelection cs = new ColumnSelection(); AlignViewportI av = new AlignViewport(cdna, cs); - Dna dna = new Dna(av, new int[] - { 0, cdna.getWidth() - 1 }); + Dna dna = new Dna(av, new int[] { 0, cdna.getWidth() - 1 }); AlignmentI translated = dna.translateCdna(); /* * Jumble the cDNA sequences and translate. */ SequenceI[] sorted = new SequenceI[cdna.getHeight()]; - final int[] jumbler = new int[] - { 6, 7, 3, 4, 2, 0, 1, 5 }; + final int[] jumbler = new int[] { 6, 7, 3, 4, 2, 0, 1, 5 }; int seqNo = 0; for (int i : jumbler) { @@ -285,8 +280,7 @@ public class DnaTest } AlignmentI cdnaReordered = new Alignment(sorted); av = new AlignViewport(cdnaReordered, cs); - dna = new Dna(av, new int[] - { 0, cdna.getWidth() - 1 }); + dna = new Dna(av, new int[] { 0, cdna.getWidth() - 1 }); AlignmentI translated2 = dna.translateCdna(); /* @@ -302,8 +296,8 @@ public class DnaTest { final String translation1 = translated.getSequenceAt( originalSequenceIndex).getSequenceAsString(); - final String translation2 = translated2.getSequenceAt(sortedSequenceIndex) - .getSequenceAsString(); + final String translation2 = translated2.getSequenceAt( + sortedSequenceIndex).getSequenceAsString(); assertEquals(translation2, translation1); sortedSequenceIndex++; } @@ -313,7 +307,7 @@ public class DnaTest * Test that all the cases in testCompareCodonPos have a 'symmetric' * comparison (without checking the actual comparison result). */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testCompareCodonPos_isSymmetric() { assertSymmetric("AAA", "GGG"); @@ -436,7 +430,7 @@ public class DnaTest /** * Weirdly, maybe worth a test to prove the helper method of this test class. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testConvertCodon() { assertEquals("[0, 1, 2]", convertCodon("AAA").toString()); diff --git a/test/jalview/analysis/GroupingTest.java b/test/jalview/analysis/GroupingTest.java index 4698d0d..6ac3c8c 100644 --- a/test/jalview/analysis/GroupingTest.java +++ b/test/jalview/analysis/GroupingTest.java @@ -25,19 +25,18 @@ public class GroupingTest Sequence s5 = new Sequence("s5", "AAAADDEDTTEE"); - SequenceGroup sg1 = new SequenceGroup(Arrays.asList(new SequenceI[] - { s1, s2 }), "Group1", null, false, false, false, 0, 5); + SequenceGroup sg1 = new SequenceGroup(Arrays.asList(new SequenceI[] { s1, + s2 }), "Group1", null, false, false, false, 0, 5); - SequenceGroup sg2 = new SequenceGroup(Arrays.asList(new SequenceI[] - { s3, s4, s5 }), "Group2", null, false, false, false, 0, 5); + SequenceGroup sg2 = new SequenceGroup(Arrays.asList(new SequenceI[] { s3, + s4, s5 }), "Group2", null, false, false, false, 0, 5); - AlignmentI alignment = new Alignment(new SequenceI[] - { s1, s2, s3, s4, s5 }); + AlignmentI alignment = new Alignment( + new SequenceI[] { s1, s2, s3, s4, s5 }); - int[] positions = new int[] - { 1, 7, 9 }; + int[] positions = new int[] { 1, 7, 9 }; - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testMakeGroupsWithBoth() { ArrayList str = new ArrayList(); @@ -53,8 +52,7 @@ public class GroupingTest SequenceGroup[] seqgroupsString = Grouping.makeGroupsFrom( alignment.getSequencesArray(), str.toArray(new String[str.size()]), - Arrays.asList(new SequenceGroup[] - { sg1, sg2 })); + Arrays.asList(new SequenceGroup[] { sg1, sg2 })); ColumnSelection cs = new ColumnSelection(); for (int p : positions) { @@ -62,9 +60,9 @@ public class GroupingTest } SequenceGroup[] seqgroupsColSel = Grouping.makeGroupsFromCols( alignment.getSequencesArray(), cs, - Arrays.asList(new SequenceGroup[] - { sg1, sg2 })); - AssertJUnit.assertEquals(seqgroupsString.length, seqgroupsColSel.length); + Arrays.asList(new SequenceGroup[] { sg1, sg2 })); + AssertJUnit + .assertEquals(seqgroupsString.length, seqgroupsColSel.length); for (int p = 0; p < seqgroupsString.length; p++) { AssertJUnit.assertEquals(seqgroupsString[p].getName(), diff --git a/test/jalview/analysis/ParsePropertiesTest.java b/test/jalview/analysis/ParsePropertiesTest.java index 1325671..e6f8e32 100644 --- a/test/jalview/analysis/ParsePropertiesTest.java +++ b/test/jalview/analysis/ParsePropertiesTest.java @@ -23,11 +23,11 @@ public class ParsePropertiesTest /** * Construct an alignment with 4 sequences with varying description format */ - @BeforeMethod(alwaysRun = true) + @BeforeMethod(alwaysRun = true) public void setUp() { - SequenceI[] seqs = new SequenceI[] - { new Sequence("sq1", "THISISAPLACEHOLDER"), + SequenceI[] seqs = new SequenceI[] { + new Sequence("sq1", "THISISAPLACEHOLDER"), new Sequence("sq2", "THISISAPLACEHOLDER"), new Sequence("sq3", "THISISAPLACEHOLDER"), new Sequence("sq4", "THISISAPLACEHOLDER") }; @@ -46,7 +46,7 @@ public class ParsePropertiesTest * more 'number characters' (0-9+.), i.e. greedily matches any trailing * numeric part of the string */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetScoresFromDescription() { String regex = ".*([-0-9.+]+)"; @@ -82,7 +82,7 @@ public class ParsePropertiesTest * character, followed by at least one 'number character', then any trailing * characters. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetScoresFromDescription_twoScores() { String regex = ".*([-0-9.+]+).+([-0-9.+]+).*"; @@ -144,7 +144,7 @@ public class ParsePropertiesTest * * @see AlignFrame.extractScores_actionPerformed */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetScoresFromDescription_wordBoundaries() { String regex = "\\W*([-+eE0-9.]+)"; diff --git a/test/jalview/analysis/RnaTest.java b/test/jalview/analysis/RnaTest.java index 3676e0b..b97a912 100644 --- a/test/jalview/analysis/RnaTest.java +++ b/test/jalview/analysis/RnaTest.java @@ -8,9 +8,10 @@ import jalview.analysis.SecStrConsensus.SimpleBP; import java.util.Vector; import org.testng.annotations.Test; + public class RnaTest { - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetSimpleBPs() throws WUSSParseException { String rna = "([{})]"; // JAL-1081 example @@ -28,7 +29,7 @@ public class RnaTest assertEquals(5, bps.get(2).bp3); // ] } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetSimpleBPs_unmatchedOpener() { String rna = "(([{})]"; @@ -42,7 +43,7 @@ public class RnaTest } } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetSimpleBPs_unmatchedCloser() { String rna = "([{})]]"; diff --git a/test/jalview/analysis/TestAlignSeq.java b/test/jalview/analysis/TestAlignSeq.java index 3c84189..d6342ef 100644 --- a/test/jalview/analysis/TestAlignSeq.java +++ b/test/jalview/analysis/TestAlignSeq.java @@ -46,7 +46,7 @@ public class TestAlignSeq /** * @throws java.lang.Exception */ - @BeforeMethod(alwaysRun = true) + @BeforeMethod(alwaysRun = true) public void setUp() throws Exception { s1 = new Sequence("Seq1", "ASDFAQQQRRRSSS"); @@ -59,14 +59,13 @@ public class TestAlignSeq } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) /** * simple test that mapping from alignment corresponds identical positions. */ public void testGetMappingForS1() { - AlignSeq as = AlignSeq - .doGlobalNWAlignment(s1, s2, AlignSeq.PEP); + AlignSeq as = AlignSeq.doGlobalNWAlignment(s1, s2, AlignSeq.PEP); System.out.println("s1: " + as.getAStr1()); System.out.println("s2: " + as.getAStr2()); @@ -86,7 +85,7 @@ public class TestAlignSeq } } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testExtractGaps() { assertNull(AlignSeq.extractGaps(null, null)); @@ -96,7 +95,7 @@ public class TestAlignSeq assertEquals("ABCD", AlignSeq.extractGaps(" .-", ". -A-B.C D.")); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testPrintAlignment() { AlignSeq as = AlignSeq.doGlobalNWAlignment(s1, s3, AlignSeq.PEP); diff --git a/test/jalview/analysis/scoremodels/FeatureScoreModelTest.java b/test/jalview/analysis/scoremodels/FeatureScoreModelTest.java index 221b230..4f71d55 100644 --- a/test/jalview/analysis/scoremodels/FeatureScoreModelTest.java +++ b/test/jalview/analysis/scoremodels/FeatureScoreModelTest.java @@ -14,20 +14,17 @@ public class FeatureScoreModelTest { public static String alntestFile = "FER1_MESCR/72-76 DVYIL\nFER1_SPIOL/71-75 DVYIL\nFER3_RAPSA/21-25 DVYVL\nFER1_MAIZE/73-77 DVYIL\n"; - int[] sf1 = new int[] - { 74, 74, 73, 73, 23, 23, -1, -1 }; + int[] sf1 = new int[] { 74, 74, 73, 73, 23, 23, -1, -1 }; - int[] sf2 = new int[] - { -1, -1, 74, 75, -1, -1, 76, 77 }; + int[] sf2 = new int[] { -1, -1, 74, 75, -1, -1, 76, 77 }; - int[] sf3 = new int[] - { -1, -1, -1, -1, -1, -1, 76, 77 }; + int[] sf3 = new int[] { -1, -1, -1, -1, -1, -1, 76, 77 }; - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testFeatureScoreModel() throws Exception { - AlignFrame alf = new FileLoader(false).LoadFileWaitTillLoaded(alntestFile, - FormatAdapter.PASTE); + AlignFrame alf = new FileLoader(false).LoadFileWaitTillLoaded( + alntestFile, FormatAdapter.PASTE); AlignmentI al = alf.getViewport().getAlignment(); AssertJUnit.assertEquals(4, al.getHeight()); AssertJUnit.assertEquals(5, al.getWidth()); @@ -59,16 +56,17 @@ public class FeatureScoreModelTest .getFeatureRenderer().getDisplayedFeatureTypes().length); AssertJUnit.assertTrue(alf.getCurrentView().areFeaturesDisplayed()); FeatureScoreModel fsm = new FeatureScoreModel(); - AssertJUnit.assertTrue(fsm.configureFromAlignmentView(alf.getCurrentView() - .getAlignPanel())); + AssertJUnit.assertTrue(fsm.configureFromAlignmentView(alf + .getCurrentView().getAlignPanel())); alf.selectAllSequenceMenuItem_actionPerformed(null); float[][] dm = fsm.findDistances(alf.getViewport().getAlignmentView( true)); AssertJUnit.assertTrue("FER1_MESCR should be identical with RAPSA (2)", dm[0][2] == 0f); - AssertJUnit.assertTrue( - "FER1_MESCR should be further from SPIOL (1) than it is from RAPSA (2)", - dm[0][1] > dm[0][2]); + AssertJUnit + .assertTrue( + "FER1_MESCR should be further from SPIOL (1) than it is from RAPSA (2)", + dm[0][1] > dm[0][2]); } } diff --git a/test/jalview/bin/CommandLineOperations.java b/test/jalview/bin/CommandLineOperations.java index 09650ea..b85536e 100644 --- a/test/jalview/bin/CommandLineOperations.java +++ b/test/jalview/bin/CommandLineOperations.java @@ -48,8 +48,11 @@ public class CommandLineOperations private static class Worker extends Thread { private final Process process; + private BufferedReader outputReader; + private BufferedReader errorReader; + private Integer exit; private Worker(Process process) @@ -172,16 +175,16 @@ public class CommandLineOperations } } - @Test(groups = - { "Functional" }, dataProvider = "allInputOpearationsData") + @Test(groups = { "Functional" }, dataProvider = "allInputOpearationsData") public void testAllInputOperations(String expectedString, String failureMsg) { Assert.assertTrue(successfulCMDs.contains(expectedString), failureMsg); } - @Test(groups = - { "Functional" }, dataProvider = "headlessModeOutputOperationsData") + @Test( + groups = { "Functional" }, + dataProvider = "headlessModeOutputOperationsData") public void testHeadlessModeOutputOperations(String harg, String type, String fileName, boolean withAWT, int expectedMinFileSize, int timeout) @@ -207,12 +210,10 @@ public class CommandLineOperations new File(fileName).delete(); } - @DataProvider(name = "allInputOpearationsData") public Object[][] getHeadlessModeInputParams() { - return new Object[][] - { + return new Object[][] { // headless mode input operations { "CMD [-color zappo] executed successfully!", "Failed command : -color zappo" }, @@ -242,16 +243,14 @@ public class CommandLineOperations { "CMD [-nousagestats] executed successfully!", "Failed command : -nousagestats" }, { "CMD [-noquestionnaire] executed successfully!", - "Failed command : -noquestionnaire nickname=www.test.com" } - }; + "Failed command : -noquestionnaire nickname=www.test.com" } }; } - + @DataProvider(name = "headlessModeOutputOperationsData") public static Object[][] getHeadlessModeOutputParams() { - return new Object[][] - { + return new Object[][] { { "nodisplay -open examples/uniref50.fa", " -eps", "test_uniref50_out.eps", true, 4096, 4000 }, { "nodisplay -open examples/uniref50.fa", " -eps", @@ -283,7 +282,6 @@ public class CommandLineOperations { "headless -open examples/uniref50.fa", " -blc", "test_uniref50_out.blc", true, 2096, 3000 }, { "headless -open examples/uniref50.fa", " -jalview", - "test_uniref50_out.jvp", true, 2096, 3000 }, - }; + "test_uniref50_out.jvp", true, 2096, 3000 }, }; } } diff --git a/test/jalview/commands/EditCommandTest.java b/test/jalview/commands/EditCommandTest.java index 6fa7c22..984cda4 100644 --- a/test/jalview/commands/EditCommandTest.java +++ b/test/jalview/commands/EditCommandTest.java @@ -30,8 +30,8 @@ public class EditCommandTest private Alignment al; - @BeforeMethod(alwaysRun = true) - public void setUp() + @BeforeMethod(alwaysRun = true) + public void setUp() { testee = new EditCommand(); seqs = new SequenceI[4]; @@ -50,7 +50,7 @@ public class EditCommandTest /** * Test inserting gap characters */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testAppendEdit_insertGap() { // set a non-standard gap character to prove it is actually used @@ -67,7 +67,7 @@ public class EditCommandTest * Test deleting characters from sequences. Note the deleteGap() action does * not check that only gap characters are being removed. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testAppendEdit_deleteGap() { testee.appendEdit(Action.DELETE_GAP, seqs, 4, 3, al, true); @@ -81,12 +81,11 @@ public class EditCommandTest * Test a cut action. The command should store the cut characters to support * undo. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testCut() { Edit ec = testee.new Edit(Action.CUT, seqs, 4, 3, al); - testee.cut(ec, new AlignmentI[] - { al }); + testee.cut(ec, new AlignmentI[] { al }); assertEquals("abcdhjk", seqs[0].getSequenceAsString()); assertEquals("fghjnopq", seqs[1].getSequenceAsString()); assertEquals("qrstxyz", seqs[2].getSequenceAsString()); @@ -102,8 +101,7 @@ public class EditCommandTest /** * Test a Paste action, where this adds sequences to an alignment. */ - @Test(groups = - { "Functional" }, enabled = false) + @Test(groups = { "Functional" }, enabled = false) // TODO fix so it works public void testPaste_addToAlignment() { @@ -112,8 +110,7 @@ public class EditCommandTest newSeqs[1] = new Sequence("newseq1", "JWMPDH"); Edit ec = testee.new Edit(Action.PASTE, newSeqs, 0, al.getWidth(), al); - testee.paste(ec, new AlignmentI[] - { al }); + testee.paste(ec, new AlignmentI[] { al }); assertEquals(6, al.getSequences().size()); assertEquals("1234567890", seqs[3].getSequenceAsString()); assertEquals("ACEFKL", seqs[4].getSequenceAsString()); @@ -123,15 +120,14 @@ public class EditCommandTest /** * Test insertGap followed by undo command */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testUndo_insertGap() { // Edit ec = testee.new Edit(Action.INSERT_GAP, seqs, 4, 3, '?'); testee.appendEdit(Action.INSERT_GAP, seqs, 4, 3, al, true); // check something changed assertEquals("abcd???efghjk", seqs[0].getSequenceAsString()); - testee.undoCommand(new AlignmentI[] - { al }); + testee.undoCommand(new AlignmentI[] { al }); assertEquals("abcdefghjk", seqs[0].getSequenceAsString()); assertEquals("fghjklmnopq", seqs[1].getSequenceAsString()); assertEquals("qrstuvwxyz", seqs[2].getSequenceAsString()); @@ -141,14 +137,13 @@ public class EditCommandTest /** * Test deleteGap followed by undo command */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testUndo_deleteGap() { testee.appendEdit(Action.DELETE_GAP, seqs, 4, 3, al, true); // check something changed assertEquals("abcdhjk", seqs[0].getSequenceAsString()); - testee.undoCommand(new AlignmentI[] - { al }); + testee.undoCommand(new AlignmentI[] { al }); // deleteGap doesn't 'remember' deleted characters, only gaps get put back assertEquals("abcd???hjk", seqs[0].getSequenceAsString()); assertEquals("fghj???nopq", seqs[1].getSequenceAsString()); @@ -159,7 +154,7 @@ public class EditCommandTest /** * Test several commands followed by an undo command */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testUndo_multipleCommands() { // delete positions 3/4/5 (counting from 1) @@ -178,8 +173,7 @@ public class EditCommandTest assertEquals("12?890", seqs[3].getSequenceAsString()); // undo edit commands - testee.undoCommand(new AlignmentI[] - { al }); + testee.undoCommand(new AlignmentI[] { al }); assertEquals("ab?????hjk", seqs[0].getSequenceAsString()); assertEquals("12?????890", seqs[3].getSequenceAsString()); } @@ -188,7 +182,7 @@ public class EditCommandTest * Unit test for JAL-1594 bug: click and drag sequence right to insert gaps - * undo did not remove them all. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testUndo_multipleInsertGaps() { testee.appendEdit(Action.INSERT_GAP, seqs, 4, 1, al, true); @@ -196,8 +190,7 @@ public class EditCommandTest testee.appendEdit(Action.INSERT_GAP, seqs, 6, 1, al, true); // undo edit commands - testee.undoCommand(new AlignmentI[] - { al }); + testee.undoCommand(new AlignmentI[] { al }); assertEquals("abcdefghjk", seqs[0].getSequenceAsString()); assertEquals("1234567890", seqs[3].getSequenceAsString()); @@ -206,14 +199,13 @@ public class EditCommandTest /** * Test cut followed by undo command */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testUndo_cut() { testee.appendEdit(Action.CUT, seqs, 4, 3, al, true); // check something changed assertEquals("abcdhjk", seqs[0].getSequenceAsString()); - testee.undoCommand(new AlignmentI[] - { al }); + testee.undoCommand(new AlignmentI[] { al }); assertEquals("abcdefghjk", seqs[0].getSequenceAsString()); assertEquals("fghjklmnopq", seqs[1].getSequenceAsString()); assertEquals("qrstuvwxyz", seqs[2].getSequenceAsString()); @@ -223,13 +215,13 @@ public class EditCommandTest /** * Test the replace command (used to manually edit a sequence) */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testReplace() { // seem to need a dataset sequence on the edited sequence here seqs[1].setDatasetSequence(seqs[1]); - new EditCommand("", Action.REPLACE, "ZXY", new SequenceI[] - { seqs[1] }, 4, 8, al); + new EditCommand("", Action.REPLACE, "ZXY", new SequenceI[] { seqs[1] }, + 4, 8, al); assertEquals("abcdefghjk", seqs[0].getSequenceAsString()); assertEquals("qrstuvwxyz", seqs[2].getSequenceAsString()); assertEquals("1234567890", seqs[3].getSequenceAsString()); @@ -240,24 +232,24 @@ public class EditCommandTest * Test that the addEdit command correctly merges insert gap commands when * possible. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testAddEdit_multipleInsertGap() { /* * 3 insert gap in a row (aka mouse drag right): */ - Edit e = new EditCommand().new Edit(Action.INSERT_GAP, new SequenceI[] - { seqs[0] }, 1, 1, al); + Edit e = new EditCommand().new Edit(Action.INSERT_GAP, + new SequenceI[] { seqs[0] }, 1, 1, al); testee.addEdit(e); SequenceI edited = new Sequence("seq0", "a?bcdefghjk"); edited.setDatasetSequence(seqs[0].getDatasetSequence()); - e = new EditCommand().new Edit(Action.INSERT_GAP, new SequenceI[] - { edited }, 2, 1, al); + e = new EditCommand().new Edit(Action.INSERT_GAP, + new SequenceI[] { edited }, 2, 1, al); testee.addEdit(e); edited = new Sequence("seq0", "a??bcdefghjk"); edited.setDatasetSequence(seqs[0].getDatasetSequence()); - e = new EditCommand().new Edit(Action.INSERT_GAP, new SequenceI[] - { edited }, 3, 1, al); + e = new EditCommand().new Edit(Action.INSERT_GAP, + new SequenceI[] { edited }, 3, 1, al); testee.addEdit(e); assertEquals(1, testee.getSize()); assertEquals(Action.INSERT_GAP, testee.getEdit(0).getAction()); @@ -267,8 +259,8 @@ public class EditCommandTest /* * Add a non-contiguous edit - should not be merged. */ - e = new EditCommand().new Edit(Action.INSERT_GAP, new SequenceI[] - { edited }, 5, 2, al); + e = new EditCommand().new Edit(Action.INSERT_GAP, + new SequenceI[] { edited }, 5, 2, al); testee.addEdit(e); assertEquals(2, testee.getSize()); assertEquals(5, testee.getEdit(1).getPosition()); @@ -277,8 +269,8 @@ public class EditCommandTest /* * Add a Delete after the Insert - should not be merged. */ - e = new EditCommand().new Edit(Action.DELETE_GAP, new SequenceI[] - { edited }, 6, 2, al); + e = new EditCommand().new Edit(Action.DELETE_GAP, + new SequenceI[] { edited }, 6, 2, al); testee.addEdit(e); assertEquals(3, testee.getSize()); assertEquals(Action.DELETE_GAP, testee.getEdit(2).getAction()); @@ -290,29 +282,29 @@ public class EditCommandTest * Test that the addEdit command correctly merges delete gap commands when * possible. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testAddEdit_multipleDeleteGap() { /* * 3 delete gap in a row (aka mouse drag left): */ seqs[0].setSequence("a???bcdefghjk"); - Edit e = new EditCommand().new Edit(Action.DELETE_GAP, new SequenceI[] - { seqs[0] }, 4, 1, al); + Edit e = new EditCommand().new Edit(Action.DELETE_GAP, + new SequenceI[] { seqs[0] }, 4, 1, al); testee.addEdit(e); assertEquals(1, testee.getSize()); SequenceI edited = new Sequence("seq0", "a??bcdefghjk"); edited.setDatasetSequence(seqs[0].getDatasetSequence()); - e = new EditCommand().new Edit(Action.DELETE_GAP, new SequenceI[] - { edited }, 3, 1, al); + e = new EditCommand().new Edit(Action.DELETE_GAP, + new SequenceI[] { edited }, 3, 1, al); testee.addEdit(e); assertEquals(1, testee.getSize()); edited = new Sequence("seq0", "a?bcdefghjk"); edited.setDatasetSequence(seqs[0].getDatasetSequence()); - e = new EditCommand().new Edit(Action.DELETE_GAP, new SequenceI[] - { edited }, 2, 1, al); + e = new EditCommand().new Edit(Action.DELETE_GAP, + new SequenceI[] { edited }, 2, 1, al); testee.addEdit(e); assertEquals(1, testee.getSize()); assertEquals(Action.DELETE_GAP, testee.getEdit(0).getAction()); @@ -322,8 +314,8 @@ public class EditCommandTest /* * Add a non-contiguous edit - should not be merged. */ - e = new EditCommand().new Edit(Action.DELETE_GAP, new SequenceI[] - { edited }, 2, 1, al); + e = new EditCommand().new Edit(Action.DELETE_GAP, + new SequenceI[] { edited }, 2, 1, al); testee.addEdit(e); assertEquals(2, testee.getSize()); assertEquals(Action.DELETE_GAP, testee.getEdit(0).getAction()); @@ -333,8 +325,8 @@ public class EditCommandTest /* * Add an Insert after the Delete - should not be merged. */ - e = new EditCommand().new Edit(Action.INSERT_GAP, new SequenceI[] - { edited }, 1, 1, al); + e = new EditCommand().new Edit(Action.INSERT_GAP, + new SequenceI[] { edited }, 1, 1, al); testee.addEdit(e); assertEquals(3, testee.getSize()); assertEquals(Action.INSERT_GAP, testee.getEdit(2).getAction()); @@ -347,12 +339,12 @@ public class EditCommandTest * case when they appear contiguous but are acting on different sequences. * They should not be merged. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testAddEdit_removeAllGaps() { seqs[0].setSequence("a???bcdefghjk"); - Edit e = new EditCommand().new Edit(Action.DELETE_GAP, new SequenceI[] - { seqs[0] }, 4, 1, al); + Edit e = new EditCommand().new Edit(Action.DELETE_GAP, + new SequenceI[] { seqs[0] }, 4, 1, al); testee.addEdit(e); seqs[1].setSequence("f??ghjklmnopq"); @@ -368,21 +360,21 @@ public class EditCommandTest * Test that the addEdit command correctly merges insert gap commands acting * on a multi-sequence selection. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testAddEdit_groupInsertGaps() { /* * 2 insert gap in a row (aka mouse drag right), on two sequences: */ - Edit e = new EditCommand().new Edit(Action.INSERT_GAP, new SequenceI[] - { seqs[0], seqs[1] }, 1, 1, al); + Edit e = new EditCommand().new Edit(Action.INSERT_GAP, new SequenceI[] { + seqs[0], seqs[1] }, 1, 1, al); testee.addEdit(e); SequenceI seq1edited = new Sequence("seq0", "a?bcdefghjk"); seq1edited.setDatasetSequence(seqs[0].getDatasetSequence()); SequenceI seq2edited = new Sequence("seq1", "f?ghjklmnopq"); seq2edited.setDatasetSequence(seqs[1].getDatasetSequence()); - e = new EditCommand().new Edit(Action.INSERT_GAP, new SequenceI[] - { seq1edited, seq2edited }, 2, 1, al); + e = new EditCommand().new Edit(Action.INSERT_GAP, new SequenceI[] { + seq1edited, seq2edited }, 2, 1, al); testee.addEdit(e); assertEquals(1, testee.getSize()); @@ -404,15 +396,14 @@ public class EditCommandTest *
  • last: --A--B-CDEF
  • * */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testPriorState_multipleInserts() { EditCommand command = new EditCommand(); SequenceI seq = new Sequence("", "--A--B-CDEF"); SequenceI ds = new Sequence("", "ABCDEF"); seq.setDatasetSequence(ds); - SequenceI[] seqs = new SequenceI[] - { seq }; + SequenceI[] seqs = new SequenceI[] { seq }; Edit e = command.new Edit(Action.INSERT_GAP, seqs, 1, 2, '-'); command.addEdit(e); e = command.new Edit(Action.INSERT_GAP, seqs, 4, 1, '-'); @@ -432,15 +423,14 @@ public class EditCommandTest *
  • End: ABC
  • * */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testPriorState_removeAllGaps() { EditCommand command = new EditCommand(); SequenceI seq = new Sequence("", "ABC"); SequenceI ds = new Sequence("", "ABC"); seq.setDatasetSequence(ds); - SequenceI[] seqs = new SequenceI[] - { seq }; + SequenceI[] seqs = new SequenceI[] { seq }; Edit e = command.new Edit(Action.DELETE_GAP, seqs, 1, 1, '-'); command.addEdit(e); e = command.new Edit(Action.DELETE_GAP, seqs, 2, 1, '-'); @@ -453,18 +443,17 @@ public class EditCommandTest /** * Test for 'undoing' a single delete edit. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testPriorState_singleDelete() { EditCommand command = new EditCommand(); SequenceI seq = new Sequence("", "ABCDEF"); SequenceI ds = new Sequence("", "ABCDEF"); seq.setDatasetSequence(ds); - SequenceI[] seqs = new SequenceI[] - { seq }; + SequenceI[] seqs = new SequenceI[] { seq }; Edit e = command.new Edit(Action.DELETE_GAP, seqs, 2, 2, '-'); command.addEdit(e); - + Map unwound = command.priorState(false); assertEquals("AB--CDEF", unwound.get(ds).getSequenceAsString()); } @@ -472,18 +461,17 @@ public class EditCommandTest /** * Test 'undoing' a single gap insertion edit command. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testPriorState_singleInsert() { EditCommand command = new EditCommand(); SequenceI seq = new Sequence("", "AB---CDEF"); SequenceI ds = new Sequence("", "ABCDEF"); seq.setDatasetSequence(ds); - SequenceI[] seqs = new SequenceI[] - { seq }; + SequenceI[] seqs = new SequenceI[] { seq }; Edit e = command.new Edit(Action.INSERT_GAP, seqs, 2, 3, '-'); command.addEdit(e); - + Map unwound = command.priorState(false); assertEquals("ABCDEF", unwound.get(ds).getSequenceAsString()); } @@ -492,7 +480,7 @@ public class EditCommandTest * Test that mimics 'remove all gaps' action. This generates delete gap edits * for contiguous gaps in each sequence separately. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testPriorState_removeGapsMultipleSeqs() { EditCommand command = new EditCommand(); @@ -506,31 +494,27 @@ public class EditCommandTest SequenceI seq = new Sequence("", "ABC-DEF"); SequenceI ds1 = new Sequence("", "ABCDEF"); seq.setDatasetSequence(ds1); - SequenceI[] seqs = new SequenceI[] - { seq }; + SequenceI[] seqs = new SequenceI[] { seq }; Edit e = command.new Edit(Action.DELETE_GAP, seqs, 0, 2, '-'); command.addEdit(e); seq = new Sequence("", "ABCDEF"); seq.setDatasetSequence(ds1); - seqs = new SequenceI[] - { seq }; + seqs = new SequenceI[] { seq }; e = command.new Edit(Action.DELETE_GAP, seqs, 3, 1, '-'); command.addEdit(e); - + /* * Two edits for the second sequence */ seq = new Sequence("", "FGHI--J"); SequenceI ds2 = new Sequence("", "FGHIJ"); seq.setDatasetSequence(ds2); - seqs = new SequenceI[] - { seq }; + seqs = new SequenceI[] { seq }; e = command.new Edit(Action.DELETE_GAP, seqs, 2, 1, '-'); command.addEdit(e); seq = new Sequence("", "FGHIJ"); seq.setDatasetSequence(ds2); - seqs = new SequenceI[] - { seq }; + seqs = new SequenceI[] { seq }; e = command.new Edit(Action.DELETE_GAP, seqs, 4, 2, '-'); command.addEdit(e); @@ -540,8 +524,7 @@ public class EditCommandTest seq = new Sequence("", "MNOPQ"); SequenceI ds3 = new Sequence("", "MNOPQ"); seq.setDatasetSequence(ds3); - seqs = new SequenceI[] - { seq }; + seqs = new SequenceI[] { seq }; e = command.new Edit(Action.DELETE_GAP, seqs, 1, 1, '-'); command.addEdit(e); @@ -556,7 +539,7 @@ public class EditCommandTest * series Delete Gap edits that each act on all sequences that share a gapped * column region. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testPriorState_removeGappedCols() { EditCommand command = new EditCommand(); @@ -576,8 +559,7 @@ public class EditCommandTest SequenceI seq3 = new Sequence("", "M-NO--PQ"); SequenceI ds3 = new Sequence("", "MNOPQ"); seq3.setDatasetSequence(ds3); - SequenceI[] seqs = new SequenceI[] - { seq1, seq2, seq3 }; + SequenceI[] seqs = new SequenceI[] { seq1, seq2, seq3 }; Edit e = command.new Edit(Action.DELETE_GAP, seqs, 0, 1, '-'); command.addEdit(e); @@ -590,8 +572,7 @@ public class EditCommandTest seq2.setDatasetSequence(ds2); seq3 = new Sequence("", "M-NOPQ"); seq3.setDatasetSequence(ds3); - seqs = new SequenceI[] - { seq1, seq2, seq3 }; + seqs = new SequenceI[] { seq1, seq2, seq3 }; e = command.new Edit(Action.DELETE_GAP, seqs, 4, 2, '-'); command.addEdit(e); diff --git a/test/jalview/datamodel/AlignedCodonFrameTest.java b/test/jalview/datamodel/AlignedCodonFrameTest.java index 35d92d3..23aa889 100644 --- a/test/jalview/datamodel/AlignedCodonFrameTest.java +++ b/test/jalview/datamodel/AlignedCodonFrameTest.java @@ -15,11 +15,10 @@ public class AlignedCodonFrameTest /** * Test the method that locates the first aligned sequence that has a mapping. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testFindAlignedSequence() { - AlignmentI cdna = new Alignment(new SequenceI[] - {}); + AlignmentI cdna = new Alignment(new SequenceI[] {}); final Sequence seq1 = new Sequence("Seq1", "C-G-TA-GC"); seq1.createDatasetSequence(); cdna.addSequence(seq1); @@ -27,8 +26,7 @@ public class AlignedCodonFrameTest seq2.createDatasetSequence(); cdna.addSequence(seq2); - AlignmentI aa = new Alignment(new SequenceI[] - {}); + AlignmentI aa = new Alignment(new SequenceI[] {}); final Sequence aseq1 = new Sequence("Seq1", "-P-R"); aseq1.createDatasetSequence(); aa.addSequence(aseq1); @@ -43,27 +41,23 @@ public class AlignedCodonFrameTest assertNull(acf.findAlignedSequence(seq1, aa)); - MapList map = new MapList(new int[] - { 1, 6 }, new int[] - { 1, 2 }, 3, 1); + MapList map = new MapList(new int[] { 1, 6 }, new int[] { 1, 2 }, 3, 1); acf.addMap(seq1.getDatasetSequence(), aseq2.getDatasetSequence(), map); /* * DNA seq1 maps to AA seq2 */ - assertEquals(aa.getSequenceAt(1), - acf.findAlignedSequence(cdna + assertEquals(aa.getSequenceAt(1), acf.findAlignedSequence(cdna .getSequenceAt(0).getDatasetSequence(), aa)); - assertEquals(cdna.getSequenceAt(0), - acf.findAlignedSequence(aa + assertEquals(cdna.getSequenceAt(0), acf.findAlignedSequence(aa .getSequenceAt(1).getDatasetSequence(), cdna)); } /** * Test the method that locates the mapped codon for a protein position. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetMappedRegion() { // introns lower case, exons upper case @@ -87,13 +81,11 @@ public class AlignedCodonFrameTest /* * Set up the mappings for the exons (upper-case bases) */ - MapList map = new MapList(new int[] - { 2, 4, 6, 6, 8, 9 }, new int[] - { 1, 2 }, 3, 1); + MapList map = new MapList(new int[] { 2, 4, 6, 6, 8, 9 }, new int[] { + 1, 2 }, 3, 1); acf.addMap(seq1.getDatasetSequence(), aseq1.getDatasetSequence(), map); - map = new MapList(new int[] - { 1, 2, 4, 5, 7, 8 }, new int[] - { 1, 2 }, 3, 1); + map = new MapList(new int[] { 1, 2, 4, 5, 7, 8 }, new int[] { 1, 2 }, + 3, 1); acf.addMap(seq2.getDatasetSequence(), aseq2.getDatasetSequence(), map); assertEquals("[2, 4]", @@ -111,7 +103,7 @@ public class AlignedCodonFrameTest assertNull(acf.getMappedRegion(seq1, aseq2, 1)); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetMappedCodon() { final Sequence seq1 = new Sequence("Seq1", "c-G-TA-gC-gT-T"); @@ -129,11 +121,10 @@ public class AlignedCodonFrameTest /* * Set up the mappings for the exons (upper-case bases) */ - MapList map = new MapList(new int[] - { 2, 4, 6, 6, 8, 9 }, new int[] - { 1, 2 }, 3, 1); + MapList map = new MapList(new int[] { 2, 4, 6, 6, 8, 9 }, new int[] { + 1, 2 }, 3, 1); acf.addMap(seq1.getDatasetSequence(), aseq1.getDatasetSequence(), map); - + assertEquals("[G, T, A]", Arrays.toString(acf.getMappedCodon( aseq1.getDatasetSequence(), 1))); assertEquals("[C, T, T]", Arrays.toString(acf.getMappedCodon( diff --git a/test/jalview/datamodel/AlignedCodonIteratorTest.java b/test/jalview/datamodel/AlignedCodonIteratorTest.java index d9c7e12..dd30b60 100644 --- a/test/jalview/datamodel/AlignedCodonIteratorTest.java +++ b/test/jalview/datamodel/AlignedCodonIteratorTest.java @@ -21,16 +21,16 @@ public class AlignedCodonIteratorTest /** * Test normal case for iterating over aligned codons. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testNext() { SequenceI from = new Sequence("Seq1", "-CgC-C-cCtAG-AtG-Gc"); from.createDatasetSequence(); SequenceI to = new Sequence("Seq1", "-PQ-R-"); to.createDatasetSequence(); - MapList map = new MapList(new int[] - { 1, 1, 3, 4, 6, 6, 8, 10, 12, 13 }, new int[] - { 1, 3 }, 3, 1); + MapList map = new MapList( + new int[] { 1, 1, 3, 4, 6, 6, 8, 10, 12, 13 }, + new int[] { 1, 3 }, 3, 1); Mapping m = new Mapping(to.getDatasetSequence(), map); Iterator codons = m.getCodonIterator(from, '-'); @@ -49,16 +49,16 @@ public class AlignedCodonIteratorTest /** * Test weird case where the mapping skips over a peptide. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testNext_unmappedPeptide() { SequenceI from = new Sequence("Seq1", "-CgC-C-cCtAG-AtG-Gc"); from.createDatasetSequence(); SequenceI to = new Sequence("Seq1", "-PQ-TR-"); to.createDatasetSequence(); - MapList map = new MapList(new int[] - { 1, 1, 3, 4, 6, 6, 8, 10, 12, 13 }, new int[] - { 1, 2, 4, 4 }, 3, 1); + MapList map = new MapList( + new int[] { 1, 1, 3, 4, 6, 6, 8, 10, 12, 13 }, new int[] { 1, + 2, 4, 4 }, 3, 1); Mapping m = new Mapping(to.getDatasetSequence(), map); Iterator codons = m.getCodonIterator(from, '-'); @@ -73,20 +73,19 @@ public class AlignedCodonIteratorTest assertEquals("R", codon.product); assertFalse(codons.hasNext()); } - + /** * Test for exception thrown for an incomplete codon. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testNext_incompleteCodon() { SequenceI from = new Sequence("Seq1", "-CgC-C-cCgTt"); from.createDatasetSequence(); SequenceI to = new Sequence("Seq1", "-PQ-R-"); to.createDatasetSequence(); - MapList map = new MapList(new int[] - { 1, 1, 3, 4, 6, 6, 8, 8 }, new int[] - { 1, 3 }, 3, 1); + MapList map = new MapList(new int[] { 1, 1, 3, 4, 6, 6, 8, 8 }, + new int[] { 1, 3 }, 3, 1); Mapping m = new Mapping(to.getDatasetSequence(), map); Iterator codons = m.getCodonIterator(from, '-'); @@ -106,18 +105,16 @@ public class AlignedCodonIteratorTest /** * Test normal case for iterating over aligned codons. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testAnother() { SequenceI from = new Sequence("Seq1", "TGCCATTACCAG-"); from.createDatasetSequence(); SequenceI to = new Sequence("Seq1", "CHYQ"); to.createDatasetSequence(); - MapList map = new MapList(new int[] - { 1, 12 }, new int[] - { 1, 4 }, 3, 1); + MapList map = new MapList(new int[] { 1, 12 }, new int[] { 1, 4 }, 3, 1); Mapping m = new Mapping(to.getDatasetSequence(), map); - + Iterator codons = m.getCodonIterator(from, '-'); AlignedCodon codon = codons.next(); assertEquals("[0, 1, 2]", codon.toString()); diff --git a/test/jalview/datamodel/AlignedCodonTest.java b/test/jalview/datamodel/AlignedCodonTest.java index a6802b1..0eec429 100644 --- a/test/jalview/datamodel/AlignedCodonTest.java +++ b/test/jalview/datamodel/AlignedCodonTest.java @@ -9,7 +9,7 @@ import org.testng.annotations.Test; public class AlignedCodonTest { - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testEquals() { AlignedCodon ac = new AlignedCodon(1, 3, 4); @@ -20,8 +20,9 @@ public class AlignedCodonTest assertTrue(ac.equals(ac)); } - @Test(groups ={ "Functional" }) - public void testToString() { + @Test(groups = { "Functional" }) + public void testToString() + { AlignedCodon ac = new AlignedCodon(1, 3, 4); assertEquals("[1, 3, 4]", ac.toString()); } diff --git a/test/jalview/datamodel/AlignmentAnnotationTests.java b/test/jalview/datamodel/AlignmentAnnotationTests.java index d32105d..265c8b8 100644 --- a/test/jalview/datamodel/AlignmentAnnotationTests.java +++ b/test/jalview/datamodel/AlignmentAnnotationTests.java @@ -10,7 +10,7 @@ import org.testng.annotations.Test; public class AlignmentAnnotationTests { - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testCopyConstructor() { SequenceI sq = new Sequence("Foo", "ARAARARARAWEAWEAWRAWEAWE"); @@ -23,6 +23,7 @@ public class AlignmentAnnotationTests alc.getProperty(key)); } } + /** * create some dummy annotation derived from the sequence * @@ -74,7 +75,7 @@ public class AlignmentAnnotationTests * different dataset frames (annotation transferred by mapping between * sequences) */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testLiftOver() { SequenceI sqFrom = new Sequence("fromLong", "QQQCDEWGH"); @@ -97,9 +98,9 @@ public class AlignmentAnnotationTests alSeq2.setStart(sqTo.getStart() + align.getSeq2Start() - 1); alSeq2.setEnd(sqTo.getStart() + align.getSeq2End() - 1); alSeq2.setDatasetSequence(sqTo); - System.out.println(new AppletFormatAdapter().formatSequences("STH", - new Alignment(new SequenceI[] - { sqFrom, alSeq1, sqTo, alSeq2 }), true)); + System.out.println(new AppletFormatAdapter() + .formatSequences("STH", new Alignment(new SequenceI[] { sqFrom, + alSeq1, sqTo, alSeq2 }), true)); Mapping mp = align.getMappingFromS1(false); @@ -119,8 +120,7 @@ public class AlignmentAnnotationTests almap2.setSequenceRef(alSeq2); almap2.adjustForAlignment(); - AlignmentI all = new Alignment(new SequenceI[] - { alSeq1, alSeq2 }); + AlignmentI all = new Alignment(new SequenceI[] { alSeq1, alSeq2 }); all.addAnnotation(almap1); all.addAnnotation(almap2); System.out.println(new AppletFormatAdapter().formatSequences("STH", @@ -157,7 +157,7 @@ public class AlignmentAnnotationTests } } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testAdjustForAlignment() { SequenceI seq = new Sequence("TestSeq", "ABCDEFG"); @@ -166,8 +166,8 @@ public class AlignmentAnnotationTests /* * Annotate positions 3/4/5 (CDE) with values 1/2/3 */ - Annotation[] anns = new Annotation[] - { null, null, new Annotation(1), new Annotation(2), new Annotation(3) }; + Annotation[] anns = new Annotation[] { null, null, new Annotation(1), + new Annotation(2), new Annotation(3) }; AlignmentAnnotation ann = new AlignmentAnnotation("SS", "secondary structure", anns); seq.addAlignmentAnnotation(ann); diff --git a/test/jalview/datamodel/AlignmentTest.java b/test/jalview/datamodel/AlignmentTest.java index 2eaae94..722fdd3 100644 --- a/test/jalview/datamodel/AlignmentTest.java +++ b/test/jalview/datamodel/AlignmentTest.java @@ -79,7 +79,7 @@ public class AlignmentTest * Read in Stockholm format test data including secondary structure * annotations. */ - @BeforeMethod(alwaysRun = true) + @BeforeMethod(alwaysRun = true) public void setUp() throws IOException { al = loadAlignment(TEST_DATA, "STH"); @@ -94,7 +94,7 @@ public class AlignmentTest /** * Test method that returns annotations that match on calcId. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testFindAnnotation_byCalcId() { Iterable anns = al @@ -106,7 +106,7 @@ public class AlignmentTest assertFalse(iter.hasNext()); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testDeleteAllAnnotations_includingAutocalculated() { AlignmentAnnotation aa = new AlignmentAnnotation("Consensus", @@ -120,7 +120,7 @@ public class AlignmentTest assertEquals("Not all deleted", 0, al.getAlignmentAnnotation().length); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testDeleteAllAnnotations_excludingAutocalculated() { AlignmentAnnotation aa = new AlignmentAnnotation("Consensus", @@ -144,7 +144,7 @@ public class AlignmentTest * * @throws IOException */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testAlignAs_dnaAsDna() throws IOException { // aligned cDNA: @@ -157,9 +157,7 @@ public class AlignmentTest * of what would normally be protein here. */ AlignedCodonFrame acf = new AlignedCodonFrame(); - MapList ml = new MapList(new int[] - { 1, 12 }, new int[] - { 1, 12 }, 1, 1); + MapList ml = new MapList(new int[] { 1, 12 }, new int[] { 1, 12 }, 1, 1); acf.addMap(al2.getSequenceAt(0), al1.getSequenceAt(0), ml); acf.addMap(al2.getSequenceAt(1), al1.getSequenceAt(1), ml); al1.addCodonFrame(acf); @@ -176,16 +174,14 @@ public class AlignmentTest * * @throws IOException */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testAlignAs_proteinAsCdna() throws IOException { // see also AlignmentUtilsTests AlignmentI al1 = loadAlignment(CDNA_SEQS_1, "FASTA"); AlignmentI al2 = loadAlignment(AA_SEQS_1, "FASTA"); AlignedCodonFrame acf = new AlignedCodonFrame(); - MapList ml = new MapList(new int[] - { 1, 12 }, new int[] - { 1, 4 }, 3, 1); + MapList ml = new MapList(new int[] { 1, 12 }, new int[] { 1, 4 }, 3, 1); acf.addMap(al1.getSequenceAt(0), al2.getSequenceAt(0), ml); acf.addMap(al1.getSequenceAt(1), al2.getSequenceAt(1), ml); al2.addCodonFrame(acf); @@ -200,7 +196,7 @@ public class AlignmentTest * * @throws IOException */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testAlignAs_cdnaAsProtein() throws IOException { /* @@ -209,9 +205,7 @@ public class AlignmentTest AlignmentI al1 = loadAlignment(CDNA_SEQS_1, "FASTA"); AlignmentI al2 = loadAlignment(AA_SEQS_1, "FASTA"); AlignedCodonFrame acf = new AlignedCodonFrame(); - MapList ml = new MapList(new int[] - { 1, 12 }, new int[] - { 1, 4 }, 3, 1); + MapList ml = new MapList(new int[] { 1, 12 }, new int[] { 1, 4 }, 3, 1); acf.addMap(al1.getSequenceAt(0), al2.getSequenceAt(0), ml); acf.addMap(al1.getSequenceAt(1), al2.getSequenceAt(1), ml); al2.addCodonFrame(acf); @@ -232,7 +226,7 @@ public class AlignmentTest * * @throws IOException */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testAlignAs_dnaAsProtein_withIntrons() throws IOException { /* @@ -247,13 +241,11 @@ public class AlignmentTest AlignedCodonFrame acf = new AlignedCodonFrame(); // Seq1 has intron at dna positions 3,4,9 so splice is AAG GCC TTT // Seq2 has intron at dna positions 1,5,6 so splice is CCG TTT AAA - MapList ml1 = new MapList(new int[] - { 1, 2, 5, 8, 10, 12 }, new int[] - { 1, 3 }, 3, 1); + MapList ml1 = new MapList(new int[] { 1, 2, 5, 8, 10, 12 }, new int[] { + 1, 3 }, 3, 1); acf.addMap(al1.getSequenceAt(0), al2.getSequenceAt(0), ml1); - MapList ml2 = new MapList(new int[] - { 2, 4, 7, 12 }, new int[] - { 1, 3 }, 3, 1); + MapList ml2 = new MapList(new int[] { 2, 4, 7, 12 }, + new int[] { 1, 3 }, 3, 1); acf.addMap(al1.getSequenceAt(1), al2.getSequenceAt(1), ml2); al2.addCodonFrame(acf); diff --git a/test/jalview/datamodel/AlignmentViewTest.java b/test/jalview/datamodel/AlignmentViewTest.java index 706e5a6..58098b9 100644 --- a/test/jalview/datamodel/AlignmentViewTest.java +++ b/test/jalview/datamodel/AlignmentViewTest.java @@ -1,4 +1,5 @@ package jalview.datamodel; + import static org.testng.Assert.assertEquals; import org.testng.annotations.Test; diff --git a/test/jalview/datamodel/ColumnSelectionTest.java b/test/jalview/datamodel/ColumnSelectionTest.java index 38e9c93..bf08b65 100644 --- a/test/jalview/datamodel/ColumnSelectionTest.java +++ b/test/jalview/datamodel/ColumnSelectionTest.java @@ -9,7 +9,7 @@ import org.testng.annotations.Test; public class ColumnSelectionTest { - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testAddElement() { ColumnSelection cs = new ColumnSelection(); @@ -25,7 +25,7 @@ public class ColumnSelectionTest * Test the remove method - in particular to verify that remove(int i) removes * the element whose value is i, _NOT_ the i'th element. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testRemoveElement() { ColumnSelection cs = new ColumnSelection(); @@ -50,7 +50,7 @@ public class ColumnSelectionTest * Test the method that finds the visible column position of an alignment * column, allowing for hidden columns. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testFindColumnPosition() { ColumnSelection cs = new ColumnSelection(); diff --git a/test/jalview/datamodel/DBRefEntryTest.java b/test/jalview/datamodel/DBRefEntryTest.java index f00cb38..665891d 100644 --- a/test/jalview/datamodel/DBRefEntryTest.java +++ b/test/jalview/datamodel/DBRefEntryTest.java @@ -13,7 +13,7 @@ public class DBRefEntryTest /** * Tests for the method that compares equality of reference (but not mapping) */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testEqualRef() { DBRefEntry ref1 = new DBRefEntry("UNIPROT", "1", "V71633"); @@ -31,14 +31,12 @@ public class DBRefEntryTest 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))); + 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))); + ref1.setMap(new Mapping(new MapList(new int[] { 1, 6 }, new int[] { 1, + 2 }, 3, 1))); assertTrue(ref1.equalRef(ref2)); assertTrue(ref2.equalRef(ref1)); } diff --git a/test/jalview/datamodel/MappingTest.java b/test/jalview/datamodel/MappingTest.java index cb528aa..7256155 100644 --- a/test/jalview/datamodel/MappingTest.java +++ b/test/jalview/datamodel/MappingTest.java @@ -17,21 +17,18 @@ public class MappingTest * trite test of the intersectVisContigs method for a simple DNA -> Protein * exon map and a range of visContigs */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testIntersectVisContigs() { - MapList fk = new MapList(new int[] - { 1, 6, 8, 13, 15, 23 }, new int[] - { 1, 7 }, 3, 1); + MapList fk = new MapList(new int[] { 1, 6, 8, 13, 15, 23 }, new int[] { + 1, 7 }, 3, 1); Mapping m = new Mapping(fk); - Mapping m_1 = m.intersectVisContigs(new int[] - { fk.getFromLowest(), fk.getFromHighest() }); - Mapping m_2 = m.intersectVisContigs(new int[] - { 1, 7, 11, 20 }); + Mapping m_1 = m.intersectVisContigs(new int[] { fk.getFromLowest(), + fk.getFromHighest() }); + Mapping m_2 = m.intersectVisContigs(new int[] { 1, 7, 11, 20 }); // assertions from output values 'as is', not checked for correctness - String result = Arrays.deepToString(m_1.map.getFromRanges() - .toArray()); + String result = Arrays.deepToString(m_1.map.getFromRanges().toArray()); System.out.println(result); assertEquals("[[1, 6], [8, 13], [15, 23]]", result); diff --git a/test/jalview/datamodel/MatchTest.java b/test/jalview/datamodel/MatchTest.java index f711a14..17a7254 100644 --- a/test/jalview/datamodel/MatchTest.java +++ b/test/jalview/datamodel/MatchTest.java @@ -1,4 +1,5 @@ package jalview.datamodel; + import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertFalse; import static org.testng.AssertJUnit.assertTrue; diff --git a/test/jalview/datamodel/PDBEntryTest.java b/test/jalview/datamodel/PDBEntryTest.java index 2e6f3f9..fe2c356 100644 --- a/test/jalview/datamodel/PDBEntryTest.java +++ b/test/jalview/datamodel/PDBEntryTest.java @@ -9,7 +9,7 @@ import org.testng.annotations.Test; public class PDBEntryTest { - @BeforeMethod(alwaysRun = true) + @BeforeMethod(alwaysRun = true) public void setUp() throws Exception { } @@ -19,45 +19,44 @@ public class PDBEntryTest { } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void test() { try { - PDBEntry pdbEntry = new PDBEntry("1xyz", "A", PDBEntry.Type.PDB, - "x/y/z/File"); + PDBEntry pdbEntry = new PDBEntry("1xyz", "A", PDBEntry.Type.PDB, + "x/y/z/File"); - PDBEntry case1 = new PDBEntry("1XYZ", "A", PDBEntry.Type.PDB, - "x/y/z/File"); - PDBEntry case2 = new PDBEntry("1xyz", "a", PDBEntry.Type.PDB, - "x/y/z/File"); - PDBEntry case3 = new PDBEntry("1xyz", "A", PDBEntry.Type.FILE, - "x/y/z/File"); - PDBEntry case4 = new PDBEntry(null, null, null, null); - PDBEntry case5 = new PDBEntry(null, "A", PDBEntry.Type.PDB, - "x/y/z/File"); - PDBEntry case6 = new PDBEntry("1xyz", null, PDBEntry.Type.PDB, - "x/y/z/File"); - PDBEntry case7 = new PDBEntry("1xyz", "A", null, "x/y/z/File"); - PDBEntry case8 = new PDBEntry("1xyz", "A", PDBEntry.Type.PDB, null); + PDBEntry case1 = new PDBEntry("1XYZ", "A", PDBEntry.Type.PDB, + "x/y/z/File"); + PDBEntry case2 = new PDBEntry("1xyz", "a", PDBEntry.Type.PDB, + "x/y/z/File"); + PDBEntry case3 = new PDBEntry("1xyz", "A", PDBEntry.Type.FILE, + "x/y/z/File"); + PDBEntry case4 = new PDBEntry(null, null, null, null); + PDBEntry case5 = new PDBEntry(null, "A", PDBEntry.Type.PDB, + "x/y/z/File"); + PDBEntry case6 = new PDBEntry("1xyz", null, PDBEntry.Type.PDB, + "x/y/z/File"); + PDBEntry case7 = new PDBEntry("1xyz", "A", null, "x/y/z/File"); + PDBEntry case8 = new PDBEntry("1xyz", "A", PDBEntry.Type.PDB, null); PDBEntry case9 = new PDBEntry("1xyz", "A", null, "x/y/z/File"); - // System.out.println(">>>> Testing case 1"); - assertTrue(pdbEntry.equals(case1)); + assertTrue(pdbEntry.equals(case1)); // System.out.println(">>>> Testing case 2"); - assertTrue(pdbEntry.equals(case2)); + assertTrue(pdbEntry.equals(case2)); // System.out.println(">>>> Testing case 3"); - assertTrue(!pdbEntry.equals(case3)); + assertTrue(!pdbEntry.equals(case3)); // System.out.println(">>>> Testing case 4"); - assertTrue(!pdbEntry.equals(case4)); + assertTrue(!pdbEntry.equals(case4)); // System.out.println(">>>> Testing case 5"); - assertTrue(!pdbEntry.equals(case5)); + assertTrue(!pdbEntry.equals(case5)); // System.out.println(">>>> Testing case 6"); - assertTrue(!pdbEntry.equals(case6)); + assertTrue(!pdbEntry.equals(case6)); // System.out.println(">>>> Testing case 7"); - assertTrue(!pdbEntry.equals(case7)); + assertTrue(!pdbEntry.equals(case7)); // System.out.println(">>>> Testing case 8"); assertTrue(pdbEntry.equals(case8)); assertTrue(pdbEntry.equals(case8)); diff --git a/test/jalview/datamodel/SearchResultsTest.java b/test/jalview/datamodel/SearchResultsTest.java index ae9512f..f12d4da 100644 --- a/test/jalview/datamodel/SearchResultsTest.java +++ b/test/jalview/datamodel/SearchResultsTest.java @@ -9,7 +9,7 @@ import org.testng.annotations.Test; public class SearchResultsTest { - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testToString() { SequenceI seq = new Sequence("", "abcdefghijklm"); diff --git a/test/jalview/datamodel/SeqCigarTest.java b/test/jalview/datamodel/SeqCigarTest.java index 3b50ce1..f71f574 100644 --- a/test/jalview/datamodel/SeqCigarTest.java +++ b/test/jalview/datamodel/SeqCigarTest.java @@ -15,7 +15,7 @@ public class SeqCigarTest * * TODO: split into separate tests */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testSomething() throws Exception { String o_seq = "asdfktryasdtqwrtsaslldddptyipqqwaslchvhttt"; @@ -51,7 +51,7 @@ public class SeqCigarTest */ assertEquals("Failed getWidth", sub_gapped_s.length(), sub_gapped.getWidth()); - + sub_gapped.getFullWidth(); assertFalse("hasDeletedRegions is incorrect", sub_gapped.hasDeletedRegions()); @@ -86,9 +86,8 @@ public class SeqCigarTest } } - SeqCigar[] set = new SeqCigar[] - { new SeqCigar(s), new SeqCigar(s_subsequence_gapped, 8, 48), - new SeqCigar(s_gapped) }; + SeqCigar[] set = new SeqCigar[] { new SeqCigar(s), + new SeqCigar(s_subsequence_gapped, 8, 48), new SeqCigar(s_gapped) }; Alignment al = new Alignment(set); for (int i = 0; i < al.getHeight(); i++) { @@ -99,9 +98,8 @@ public class SeqCigarTest } System.out.println("Gapped."); - set = new SeqCigar[] - { new SeqCigar(s), new SeqCigar(s_subsequence_gapped, 8, 48), - new SeqCigar(s_gapped) }; + set = new SeqCigar[] { new SeqCigar(s), + new SeqCigar(s_subsequence_gapped, 8, 48), new SeqCigar(s_gapped) }; set[0].deleteRange(20, 25); al = new Alignment(set); for (int i = 0; i < al.getHeight(); i++) @@ -126,18 +124,14 @@ public class SeqCigarTest * @return String */ - protected void testCigar_string(Sequence seq, String ex_cs_gapped) { SeqCigar c_sgapped = new SeqCigar(seq); String cs_gapped = c_sgapped.getCigarstring(); - assertEquals("Failed getCigarstring", ex_cs_gapped, - cs_gapped); + assertEquals("Failed getCigarstring", ex_cs_gapped, cs_gapped); } - - protected void testSeqRecovery(SeqCigar gen_sgapped, - SequenceI s_gapped) + protected void testSeqRecovery(SeqCigar gen_sgapped, SequenceI s_gapped) { // this is non-rigorous - start and end recovery is not tested. SequenceI gen_sgapped_s = gen_sgapped.getSeq('-'); diff --git a/test/jalview/datamodel/SequenceDummyTest.java b/test/jalview/datamodel/SequenceDummyTest.java index 4629a47..eec2e2c 100644 --- a/test/jalview/datamodel/SequenceDummyTest.java +++ b/test/jalview/datamodel/SequenceDummyTest.java @@ -5,19 +5,18 @@ import static org.testng.AssertJUnit.assertTrue; import org.testng.annotations.Test; - public class SequenceDummyTest { /** * test for become method */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testBecome() { SequenceI seq = new Sequence("OrigSeq", "ASEQUENCE"); SequenceFeature ofeat = new SequenceFeature("NewFeat", "somedesc", 3, 12, 2.3f, "none"); - + SequenceDummy dummySeq = new SequenceDummy("OrigSeq"); dummySeq.addSequenceFeature(ofeat); dummySeq.become(seq); diff --git a/test/jalview/datamodel/SequenceTest.java b/test/jalview/datamodel/SequenceTest.java index 4d08b15..f1b93e1 100644 --- a/test/jalview/datamodel/SequenceTest.java +++ b/test/jalview/datamodel/SequenceTest.java @@ -15,12 +15,13 @@ public class SequenceTest { SequenceI seq; - @BeforeMethod(alwaysRun = true) + @BeforeMethod(alwaysRun = true) public void setUp() { seq = new Sequence("FER1", "AKPNGVL"); } - @Test(groups ={ "Functional" }) + + @Test(groups = { "Functional" }) public void testInsertGapsAndGapmaps() { SequenceI aseq = seq.deriveSequence(); @@ -35,7 +36,7 @@ public class SequenceTest assertEquals("Gap interval 2 end wrong", 8, gapInt.get(1)[1]); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetAnnotation() { // initial state returns null not an empty array @@ -51,12 +52,15 @@ public class SequenceTest assertNull(seq.getAnnotation()); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetAnnotation_forLabel() { - AlignmentAnnotation ann1 = addAnnotation("label1", "desc1", "calcId1", 1f); - AlignmentAnnotation ann2 = addAnnotation("label2", "desc2", "calcId2", 1f); - AlignmentAnnotation ann3 = addAnnotation("label1", "desc3", "calcId3", 1f); + AlignmentAnnotation ann1 = addAnnotation("label1", "desc1", "calcId1", + 1f); + AlignmentAnnotation ann2 = addAnnotation("label2", "desc2", "calcId2", + 1f); + AlignmentAnnotation ann3 = addAnnotation("label1", "desc3", "calcId3", + 1f); AlignmentAnnotation[] anns = seq.getAnnotation("label1"); assertEquals(2, anns.length); assertSame(ann1, anns[0]); @@ -64,17 +68,16 @@ public class SequenceTest } private AlignmentAnnotation addAnnotation(String label, - String description, String calcId, - float value) + String description, String calcId, float value) { - final AlignmentAnnotation annotation = new AlignmentAnnotation(label, description, - value); + final AlignmentAnnotation annotation = new AlignmentAnnotation(label, + description, value); annotation.setCalcId(calcId); seq.addAlignmentAnnotation(annotation); return annotation; } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetAlignmentAnnotations_forCalcIdAndLabel() { AlignmentAnnotation ann1 = addAnnotation("label1", "desc1", "calcId1", @@ -85,16 +88,14 @@ public class SequenceTest 1f); AlignmentAnnotation ann4 = addAnnotation("label2", "desc3", "calcId2", 1f); - AlignmentAnnotation ann5 = addAnnotation("label5", "desc3", null, - 1f); - AlignmentAnnotation ann6 = addAnnotation(null, "desc3", "calcId3", - 1f); + AlignmentAnnotation ann5 = addAnnotation("label5", "desc3", null, 1f); + AlignmentAnnotation ann6 = addAnnotation(null, "desc3", "calcId3", 1f); List anns = seq.getAlignmentAnnotations("calcId2", "label2"); assertEquals(2, anns.size()); assertSame(ann2, anns.get(0)); assertSame(ann4, anns.get(1)); - + assertTrue(seq.getAlignmentAnnotations("calcId2", "label3").isEmpty()); assertTrue(seq.getAlignmentAnnotations("calcId3", "label5").isEmpty()); assertTrue(seq.getAlignmentAnnotations("calcId2", null).isEmpty()); @@ -107,7 +108,7 @@ public class SequenceTest * setting the sequenceRef on the annotation. Adding the same annotation twice * should be ignored. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testAddAlignmentAnnotation() { assertNull(seq.getAnnotation()); @@ -137,7 +138,7 @@ public class SequenceTest } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetStartGetEnd() { SequenceI seq = new Sequence("test", "ABCDEF"); @@ -157,7 +158,7 @@ public class SequenceTest * Tests for the method that returns an alignment column position (base 1) for * a given sequence position (base 1). */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testFindIndex() { SequenceI seq = new Sequence("test", "ABCDEF"); @@ -185,7 +186,7 @@ public class SequenceTest * Tests for the method that returns a dataset sequence position (base 1) for * an aligned column position (base 0). */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testFindPosition() { SequenceI seq = new Sequence("test", "ABCDEF"); @@ -220,7 +221,7 @@ public class SequenceTest assertEquals(7, seq.findPosition(11)); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testDeleteChars() { SequenceI seq = new Sequence("test", "ABCDEF"); @@ -238,7 +239,7 @@ public class SequenceTest assertEquals(6, seq.getEnd()); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testInsertCharAt() { // non-static methods: @@ -255,7 +256,7 @@ public class SequenceTest * Test the method that returns an array of aligned sequence positions where * the array index is the data sequence position (both base 0). */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGapMap() { SequenceI seq = new Sequence("test", "-A--B-CD-E--F-"); @@ -267,7 +268,7 @@ public class SequenceTest * Test the method that gets sequence features, either from the sequence or * its dataset. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetSequenceFeatures() { SequenceI seq = new Sequence("test", "GATCAT"); @@ -316,7 +317,7 @@ public class SequenceTest * entries are the residue positions at the sequence position (or to the right * if a gap) */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testFindPositionMap() { /* @@ -327,14 +328,14 @@ public class SequenceTest */ Sequence seq = new Sequence("TestSeq", "AB.C-D E."); int[] map = seq.findPositionMap(); - assertEquals(Arrays.toString(new int[] - { 1, 2, 3, 3, 4, 4, 5, 5, 6 }), Arrays.toString(map)); + assertEquals(Arrays.toString(new int[] { 1, 2, 3, 3, 4, 4, 5, 5, 6 }), + Arrays.toString(map)); } /** * Test for getSubsequence */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetSubsequence() { SequenceI seq = new Sequence("TestSeq", "ABCDEFG"); @@ -354,7 +355,7 @@ public class SequenceTest /** * Test for deriveSequence applied to a sequence with a dataset */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testDeriveSequence_existingDataset() { SequenceI seq = new Sequence("Seq1", "CD"); @@ -369,7 +370,7 @@ public class SequenceTest /** * Test for deriveSequence applied to an ungapped sequence with no dataset */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testDeriveSequence_noDatasetUngapped() { SequenceI seq = new Sequence("Seq1", "ABCDEF"); @@ -384,7 +385,7 @@ public class SequenceTest /** * Test for deriveSequence applied to a gapped sequence with no dataset */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testDeriveSequence_noDatasetGapped() { SequenceI seq = new Sequence("Seq1", "AB-C.D EF"); diff --git a/test/jalview/datamodel/xdb/embl/EmblFileTest.java b/test/jalview/datamodel/xdb/embl/EmblFileTest.java index 81aae0b..e58cf35 100644 --- a/test/jalview/datamodel/xdb/embl/EmblFileTest.java +++ b/test/jalview/datamodel/xdb/embl/EmblFileTest.java @@ -15,8 +15,7 @@ import org.testng.annotations.Test; public class EmblFileTest { // adapted from http://www.ebi.ac.uk/Tools/dbfetch/dbfetch/embl/x53828/emblxml - private static final String TESTDATA = - "" + private static final String TESTDATA = "" + "" + "" + "Chicken LDH-A mRNA for lactate dehydrogenase A chain (EC 1.1.1.27)" @@ -26,12 +25,12 @@ public class EmblFileTest + "L-lactate dehydrogenase A-chainpickle" + "MSLKDHLIHNKeith" + "" - + "" + + "" + "601058" - + "" + + "" + "GTGACG"; - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetEmblFile() { Vector entries = EmblFile.getEmblFile( diff --git a/test/jalview/ext/jmol/JmolViewerTest.java b/test/jalview/ext/jmol/JmolViewerTest.java index aa127cf..3df2da9 100644 --- a/test/jalview/ext/jmol/JmolViewerTest.java +++ b/test/jalview/ext/jmol/JmolViewerTest.java @@ -25,8 +25,7 @@ public class JmolViewerTest @BeforeClass(alwaysRun = true) public static void setUpBeforeClass() throws Exception { - jalview.bin.Jalview.main(new String[] - { + jalview.bin.Jalview.main(new String[] { "-noquestionnaire -nonews -props", "test/jalview/ext/rbvi/chimera/testProps.jvprops" }); } @@ -40,7 +39,7 @@ public class JmolViewerTest jalview.gui.Desktop.instance.closeAll_actionPerformed(null); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testSingleSeqViewJMol() { Cache.setProperty(Preferences.STRUCTURE_DISPLAY, ViewerType.JMOL.name()); @@ -55,7 +54,8 @@ public class JmolViewerTest { dsq = dsq.getDatasetSequence(); } - if (dsq.getAllPDBEntries() != null && dsq.getAllPDBEntries().size() > 0) + if (dsq.getAllPDBEntries() != null + && dsq.getAllPDBEntries().size() > 0) { for (int q = 0; q < dsq.getAllPDBEntries().size(); q++) { @@ -64,8 +64,8 @@ public class JmolViewerTest structureViewer.setViewerType(ViewerType.JMOL); JalviewStructureDisplayI jmolViewer = structureViewer .viewStructures(dsq.getAllPDBEntries().elementAt(q), - new SequenceI[] - { sq }, af.getCurrentView().getAlignPanel()); + new SequenceI[] { sq }, af.getCurrentView() + .getAlignPanel()); /* * Wait for viewer load thread to complete */ diff --git a/test/jalview/ext/jmol/PDBFileWithJmolTest.java b/test/jalview/ext/jmol/PDBFileWithJmolTest.java index fd465cf..4ccb6e3 100644 --- a/test/jalview/ext/jmol/PDBFileWithJmolTest.java +++ b/test/jalview/ext/jmol/PDBFileWithJmolTest.java @@ -44,13 +44,13 @@ import MCview.PDBfile; */ public class PDBFileWithJmolTest { - String[] testFile = new String[] - { "./examples/1GAQ.txt", "./test/jalview/ext/jmol/1QCF.pdb" }; // , + String[] testFile = new String[] { "./examples/1GAQ.txt", + "./test/jalview/ext/jmol/1QCF.pdb" }; // , // "./examples/DNMT1_MOUSE.pdb" // }; - @BeforeMethod(alwaysRun = true) + @BeforeMethod(alwaysRun = true) public void setUp() { Cache.applicationProperties.setProperty("STRUCT_FROM_PDB", @@ -59,7 +59,7 @@ public class PDBFileWithJmolTest Boolean.TRUE.toString()); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testAlignmentLoader() throws Exception { for (String f : testFile) @@ -71,7 +71,7 @@ public class PDBFileWithJmolTest } } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testFileParser() throws Exception { for (String pdbStr : testFile) @@ -93,14 +93,12 @@ public class PDBFileWithJmolTest + " to the same sequence as MCView", sq.getSequenceAsString(), mcseqs.remove(0) .getSequenceAsString()); - AlignmentI al = new Alignment(new SequenceI[] - { sq }); + AlignmentI al = new Alignment(new SequenceI[] { sq }); validateSecStrRows(al); } } } - private void validateSecStrRows(AlignmentI al) { if (!al.isNucleotide()) diff --git a/test/jalview/ext/paradise/TestAnnotate3D.java b/test/jalview/ext/paradise/TestAnnotate3D.java index 126c221..679385a 100644 --- a/test/jalview/ext/paradise/TestAnnotate3D.java +++ b/test/jalview/ext/paradise/TestAnnotate3D.java @@ -43,8 +43,7 @@ import compbio.util.FileUtil; public class TestAnnotate3D { - @Test(groups = - { "Functional" }, enabled = false) + @Test(groups = { "Functional" }, enabled = false) public void test1GIDbyId() throws Exception { // use same ID as standard tests given at @@ -54,8 +53,7 @@ public class TestAnnotate3D testRNAMLcontent(ids, null); } - @Test(groups = - { "Functional" }, enabled = false) + @Test(groups = { "Functional" }, enabled = false) public void testIdVsContent2GIS() throws Exception { Iterator ids = Annotate3D.getRNAMLForPDBId("2GIS"); @@ -99,8 +97,7 @@ public class TestAnnotate3D * * @throws Exception */ - @Test(groups = - { "Functional" }, enabled = false) + @Test(groups = { "Functional" }, enabled = false) public void testPDBfileVsRNAML() throws Exception { PDBfile pdbf = new PDBfile(true, false, true, "examples/2GIS.pdb", @@ -114,8 +111,7 @@ public class TestAnnotate3D testRNAMLcontent(readers, pdbf); } - @Test(groups = - { "Functional" }, enabled = false) + @Test(groups = { "Functional" }, enabled = false) private void testRNAMLcontent(Iterator readers, PDBfile pdbf) throws Exception { @@ -149,9 +145,9 @@ public class TestAnnotate3D String sq_ = new String(sq.getSequence()).toLowerCase(); for (SequenceI _struseq : pdbf.getSeqsAsArray()) { - final String lowerCase = new String(_struseq.getSequence()).toLowerCase(); - if (lowerCase.equals( - sq_)) + final String lowerCase = new String(_struseq.getSequence()) + .toLowerCase(); + if (lowerCase.equals(sq_)) { struseq = _struseq; break; @@ -159,11 +155,13 @@ public class TestAnnotate3D } if (struseq == null) { - AssertJUnit.fail("Couldn't find this sequence in original input:\n" - + new FastaFile().print(new SequenceI[] - { sq }) - + "\n\nOriginal input:\n" - + new FastaFile().print(pdbf.getSeqsAsArray()) + "\n"); + AssertJUnit + .fail("Couldn't find this sequence in original input:\n" + + new FastaFile() + .print(new SequenceI[] { sq }) + + "\n\nOriginal input:\n" + + new FastaFile().print(pdbf.getSeqsAsArray()) + + "\n"); } } } diff --git a/test/jalview/ext/rbvi/chimera/AllTests.java b/test/jalview/ext/rbvi/chimera/AllTests.java index 1d14751..c310c9f 100644 --- a/test/jalview/ext/rbvi/chimera/AllTests.java +++ b/test/jalview/ext/rbvi/chimera/AllTests.java @@ -5,8 +5,7 @@ import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; @RunWith(Suite.class) -@SuiteClasses( -{}) +@SuiteClasses({}) public class AllTests { diff --git a/test/jalview/ext/rbvi/chimera/ChimeraCommandsTest.java b/test/jalview/ext/rbvi/chimera/ChimeraCommandsTest.java index a3e13e8..156f2bd 100644 --- a/test/jalview/ext/rbvi/chimera/ChimeraCommandsTest.java +++ b/test/jalview/ext/rbvi/chimera/ChimeraCommandsTest.java @@ -13,7 +13,7 @@ import org.testng.annotations.Test; public class ChimeraCommandsTest { - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testAddColourRange() { Map>>> map = new LinkedHashMap>>>(); @@ -41,33 +41,27 @@ public class ChimeraCommandsTest // inspect positions List posList = map.get(Color.pink).get(1).get("A"); assertEquals(2, posList.size()); - assertTrue(Arrays.equals(new int[] - { 2, 4 }, posList.get(0))); - assertTrue(Arrays.equals(new int[] - { 8, 8 }, posList.get(1))); + assertTrue(Arrays.equals(new int[] { 2, 4 }, posList.get(0))); + assertTrue(Arrays.equals(new int[] { 8, 8 }, posList.get(1))); posList = map.get(Color.pink).get(1).get("B"); assertEquals(1, posList.size()); - assertTrue(Arrays.equals(new int[] - { 5, 7 }, posList.get(0))); + assertTrue(Arrays.equals(new int[] { 5, 7 }, posList.get(0))); posList = map.get(Color.red).get(0).get("B"); assertEquals(1, posList.size()); - assertTrue(Arrays.equals(new int[] - { 1, 4 }, posList.get(0))); + assertTrue(Arrays.equals(new int[] { 1, 4 }, posList.get(0))); posList = map.get(Color.red).get(1).get("A"); assertEquals(1, posList.size()); - assertTrue(Arrays.equals(new int[] - { 3, 5 }, posList.get(0))); + assertTrue(Arrays.equals(new int[] { 3, 5 }, posList.get(0))); posList = map.get(Color.orange).get(0).get("C"); assertEquals(1, posList.size()); - assertTrue(Arrays.equals(new int[] - { 5, 9 }, posList.get(0))); + assertTrue(Arrays.equals(new int[] { 5, 9 }, posList.get(0))); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testBuildColourCommands() { diff --git a/test/jalview/ext/rbvi/chimera/ChimeraConnect.java b/test/jalview/ext/rbvi/chimera/ChimeraConnect.java index e7f95a0..c3e42c0 100644 --- a/test/jalview/ext/rbvi/chimera/ChimeraConnect.java +++ b/test/jalview/ext/rbvi/chimera/ChimeraConnect.java @@ -11,7 +11,7 @@ import ext.edu.ucsf.rbvi.strucviz2.StructureManager; public class ChimeraConnect { - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testLaunchAndExit() { final StructureManager structureManager = new StructureManager(true); diff --git a/test/jalview/ext/rbvi/chimera/JalviewChimeraView.java b/test/jalview/ext/rbvi/chimera/JalviewChimeraView.java index 34e07f2..ad0cba0 100644 --- a/test/jalview/ext/rbvi/chimera/JalviewChimeraView.java +++ b/test/jalview/ext/rbvi/chimera/JalviewChimeraView.java @@ -26,8 +26,7 @@ public class JalviewChimeraView @BeforeClass(alwaysRun = true) public static void setUpBeforeClass() throws Exception { - jalview.bin.Jalview.main(new String[] - { + jalview.bin.Jalview.main(new String[] { "-noquestionnaire -nonews -props", "test/jalview/ext/rbvi/chimera/testProps.jvprops" }); } @@ -41,7 +40,7 @@ public class JalviewChimeraView jalview.gui.Desktop.instance.closeAll_actionPerformed(null); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testSingleSeqViewChimera() { Cache.setProperty(Preferences.STRUCTURE_DISPLAY, @@ -58,7 +57,8 @@ public class JalviewChimeraView { dsq = dsq.getDatasetSequence(); } - if (dsq.getAllPDBEntries() != null && dsq.getAllPDBEntries().size() > 0) + if (dsq.getAllPDBEntries() != null + && dsq.getAllPDBEntries().size() > 0) { for (int q = 0; q < dsq.getAllPDBEntries().size(); q++) { @@ -67,8 +67,8 @@ public class JalviewChimeraView structureViewer.setViewerType(ViewerType.CHIMERA); JalviewStructureDisplayI chimeraViewer = structureViewer .viewStructures(dsq.getAllPDBEntries().elementAt(q), - new SequenceI[] - { sq }, af.getCurrentView().getAlignPanel()); + new SequenceI[] { sq }, af.getCurrentView() + .getAlignPanel()); /* * Wait for viewer load thread to complete */ diff --git a/test/jalview/gui/AlignViewportTest.java b/test/jalview/gui/AlignViewportTest.java index 0b5840c..b83e069 100644 --- a/test/jalview/gui/AlignViewportTest.java +++ b/test/jalview/gui/AlignViewportTest.java @@ -28,6 +28,7 @@ public class AlignViewportTest { AlignmentI al; + AlignViewport testee; @BeforeClass(alwaysRun = true) @@ -37,20 +38,19 @@ public class AlignViewportTest "test/jalview/testProps.jvprops" }); } - @BeforeMethod(alwaysRun = true) + @BeforeMethod(alwaysRun = true) public void setUp() { SequenceI seq1 = new Sequence("Seq1", "ABC"); SequenceI seq2 = new Sequence("Seq2", "ABC"); SequenceI seq3 = new Sequence("Seq3", "ABC"); - SequenceI[] seqs = new SequenceI[] - { seq1, seq2, seq3 }; + SequenceI[] seqs = new SequenceI[] { seq1, seq2, seq3 }; al = new Alignment(seqs); al.setDataset(null); testee = new AlignViewport(al); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testCollateForPdb() { /* @@ -64,14 +64,11 @@ public class AlignViewportTest * seq1 and seq3 refer to 1ABC, seq2 to 2ABC, none to 3ABC */ al.getSequenceAt(0).getDatasetSequence() - .addPDBId( - new PDBEntry("1ABC", "B", Type.PDB, "1ABC.pdb")); + .addPDBId(new PDBEntry("1ABC", "B", Type.PDB, "1ABC.pdb")); al.getSequenceAt(2).getDatasetSequence() - .addPDBId( - new PDBEntry("1ABC", "B", Type.PDB, "1ABC.pdb")); + .addPDBId(new PDBEntry("1ABC", "B", Type.PDB, "1ABC.pdb")); al.getSequenceAt(1).getDatasetSequence() - .addPDBId( - new PDBEntry("2ABC", "C", Type.PDB, "2ABC.pdb")); + .addPDBId(new PDBEntry("2ABC", "C", Type.PDB, "2ABC.pdb")); /* * Add a second chain PDB xref to Seq2 - should not result in a duplicate in * the results @@ -87,8 +84,8 @@ public class AlignViewportTest /* * run method under test */ - SequenceI[][] seqs = testee.collateForPDB(new PDBEntry[] - { pdb1, pdb2, pdb3 }); + SequenceI[][] seqs = testee.collateForPDB(new PDBEntry[] { pdb1, pdb2, + pdb3 }); // seq1 and seq3 refer to PDBEntry[0] assertEquals(2, seqs[0].length); @@ -107,7 +104,7 @@ public class AlignViewportTest * Test that a mapping is not deregistered when a second view is closed but * the first still holds a reference to the mapping */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testDeregisterMapping_onCloseView() { /* @@ -115,16 +112,16 @@ public class AlignViewportTest */ AlignFrame af1 = new FileLoader().LoadFileWaitTillLoaded( ">Seq1\nCAGT\n", FormatAdapter.PASTE); - + AlignedCodonFrame acf1 = new AlignedCodonFrame(); AlignedCodonFrame acf2 = new AlignedCodonFrame(); - + Set mappings = new LinkedHashSet(); mappings.add(acf1); mappings.add(acf2); af1.getViewport().getAlignment().setCodonFrames(mappings); af1.newView_actionPerformed(null); - + /* * Verify that creating the alignment for the new View has registered the * mappings @@ -134,7 +131,7 @@ public class AlignViewportTest assertEquals(2, ssm.seqmappings.size()); assertTrue(ssm.seqmappings.contains(acf1)); assertTrue(ssm.seqmappings.contains(acf2)); - + /* * Close the second view. Verify that mappings are not removed as the first * view still holds a reference to them. @@ -148,7 +145,7 @@ public class AlignViewportTest /** * Test that a mapping is deregistered if no alignment holds a reference to it */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testDeregisterMapping_withNoReference() { Desktop d = Desktop.instance; @@ -161,11 +158,11 @@ public class AlignViewportTest ">Seq1\nRSVQ\n", FormatAdapter.PASTE); AlignFrame af2 = new FileLoader().LoadFileWaitTillLoaded( ">Seq2\nDGEL\n", FormatAdapter.PASTE); - + AlignedCodonFrame acf1 = new AlignedCodonFrame(); AlignedCodonFrame acf2 = new AlignedCodonFrame(); AlignedCodonFrame acf3 = new AlignedCodonFrame(); - + Set mappings1 = new LinkedHashSet(); mappings1.add(acf1); af1.getViewport().getAlignment().setCodonFrames(mappings1); @@ -174,7 +171,7 @@ public class AlignViewportTest mappings2.add(acf2); mappings2.add(acf3); af2.getViewport().getAlignment().setCodonFrames(mappings2); - + /* * AlignFrame1 has mapping acf1, AlignFrame2 has acf2 and acf3 */ @@ -201,7 +198,7 @@ public class AlignViewportTest * Test that a mapping is not deregistered if another alignment holds a * reference to it */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testDeregisterMapping_withReference() { Desktop d = Desktop.instance; @@ -209,30 +206,30 @@ public class AlignViewportTest StructureSelectionManager ssm = StructureSelectionManager .getStructureSelectionManager(Desktop.instance); ssm.resetAll(); - + AlignFrame af1 = new FileLoader().LoadFileWaitTillLoaded( ">Seq1\nRSVQ\n", FormatAdapter.PASTE); AlignFrame af2 = new FileLoader().LoadFileWaitTillLoaded( ">Seq2\nDGEL\n", FormatAdapter.PASTE); - + AlignedCodonFrame acf1 = new AlignedCodonFrame(); AlignedCodonFrame acf2 = new AlignedCodonFrame(); AlignedCodonFrame acf3 = new AlignedCodonFrame(); - + Set mappings1 = new LinkedHashSet(); mappings1.add(acf1); mappings1.add(acf2); af1.getViewport().getAlignment().setCodonFrames(mappings1); - + Set mappings2 = new LinkedHashSet(); mappings2.add(acf2); mappings2.add(acf3); af2.getViewport().getAlignment().setCodonFrames(mappings2); - + /* * AlignFrame1 has mappings acf1 and acf2, AlignFrame2 has acf2 and acf3 */ - + Set ssmMappings = ssm.seqmappings; assertEquals(0, ssmMappings.size()); ssm.registerMapping(acf1); @@ -241,7 +238,7 @@ public class AlignViewportTest assertEquals(2, ssmMappings.size()); ssm.registerMapping(acf3); assertEquals(3, ssmMappings.size()); - + /* * Closing AlignFrame2 should remove mapping acf3 from * StructureSelectionManager, but not acf2, since AlignFrame1 still has a diff --git a/test/jalview/gui/AnnotationChooserTest.java b/test/jalview/gui/AnnotationChooserTest.java index ae56fb4..1cd8efa 100644 --- a/test/jalview/gui/AnnotationChooserTest.java +++ b/test/jalview/gui/AnnotationChooserTest.java @@ -52,7 +52,7 @@ public class AnnotationChooserTest AlignFrame af; - @BeforeMethod(alwaysRun = true) + @BeforeMethod(alwaysRun = true) public void setUp() throws IOException { // pin down annotation sort order for test @@ -85,8 +85,7 @@ public class AnnotationChooserTest private void addAnnotations() { Annotation an = new Annotation(2f); - Annotation[] anns = new Annotation[] - { an, an, an }; + Annotation[] anns = new Annotation[] { an, an, an }; AlignmentAnnotation ann0 = new AlignmentAnnotation("IUPRED", "", anns); AlignmentAnnotation ann1 = new AlignmentAnnotation("Beauty", "", anns); AlignmentAnnotation ann2 = new AlignmentAnnotation("JMol", "", anns); @@ -107,7 +106,7 @@ public class AnnotationChooserTest /** * Test creation of panel with OK and Cancel buttons */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testBuildActionButtonsPanel() { testee = new AnnotationChooser(parentPanel); @@ -136,7 +135,7 @@ public class AnnotationChooserTest * Test 'Apply to' has 3 radio buttons enabled, 'Selected Sequences' selected, * when there is a current selection group. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testBuildApplyToOptionsPanel_withSelectionGroup() { selectSequences(0, 2, 3); @@ -183,7 +182,7 @@ public class AnnotationChooserTest * Test 'Apply to' has 1 radio button enabled, 'All Sequences' selected, when * there is no current selection group. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testBuildApplyToOptionsPanel_noSelectionGroup() { testee = new AnnotationChooser(parentPanel); @@ -224,7 +223,7 @@ public class AnnotationChooserTest /** * Test Show and Hide radio buttons created, with Hide initially selected. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testBuildShowHidePanel() { testee = new AnnotationChooser(parentPanel); @@ -262,7 +261,7 @@ public class AnnotationChooserTest /** * Test construction of panel containing two sub-panels */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testBuildShowHideOptionsPanel() { testee = new AnnotationChooser(parentPanel); @@ -279,7 +278,7 @@ public class AnnotationChooserTest * Test that annotation types are (uniquely) identified. * */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetAnnotationTypes() { selectSequences(1); @@ -311,7 +310,7 @@ public class AnnotationChooserTest * We expect all annotations of that type to be set hidden. Other annotations * should be left visible. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testSelectType_hideForAll() { selectSequences(1, 2); @@ -347,7 +346,7 @@ public class AnnotationChooserTest * We expect the annotations of that type, linked to the sequence group, to be * set hidden. Other annotations should be left visible. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testSelectType_hideForSelected() { selectSequences(1, 2); @@ -384,7 +383,7 @@ public class AnnotationChooserTest * We expect all annotations of that type to be set visible. Other annotations * should be left unchanged. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testDeselectType_hideForAll() { selectSequences(1, 2); @@ -426,7 +425,7 @@ public class AnnotationChooserTest * We expect the annotations of that type, linked to the sequence group, to be * set visible. Other annotations should be left unchanged. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testDeselectType_hideForSelected() { selectSequences(1, 2); @@ -461,7 +460,7 @@ public class AnnotationChooserTest * We expect all annotations of that type to be set visible. Other annotations * should be left unchanged */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testSelectType_showForAll() { selectSequences(1, 2); @@ -500,7 +499,7 @@ public class AnnotationChooserTest * We expect all annotations of that type, linked to the sequence group, to be * set visible. Other annotations should be left unchanged */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testSelectType_showForSelected() { // sequences 1 and 2 have annotations IUPred and Jmol @@ -542,7 +541,7 @@ public class AnnotationChooserTest * We expect all annotations of that type to be set hidden. Other annotations * should be left unchanged. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testDeselectType_showForAll() { selectSequences(1, 2); @@ -583,7 +582,7 @@ public class AnnotationChooserTest * We expect the annotations of that type, linked to the sequence group, to be * set hidden. Other annotations should be left unchanged. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testDeselectType_showForSelected() { selectSequences(1, 2); @@ -677,7 +676,7 @@ public class AnnotationChooserTest * Test cases include sequences in the selection group, and others not in the * group. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testIsInActionScope_selectedScope() { // sequences 1 and 2 have annotations 4 and 3 respectively @@ -703,7 +702,7 @@ public class AnnotationChooserTest * Test cases include sequences in the selection group, and others not in the * group. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testIsInActionScope_unselectedScope() { // sequences 1 and 2 have annotations 4 and 3 respectively @@ -727,7 +726,7 @@ public class AnnotationChooserTest /** * Test that the reset method restores previous visibility flags. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testResetOriginalState() { testee = new AnnotationChooser(parentPanel); diff --git a/test/jalview/gui/FontChooserTest.java b/test/jalview/gui/FontChooserTest.java index 8da11b8..1bdf18f 100644 --- a/test/jalview/gui/FontChooserTest.java +++ b/test/jalview/gui/FontChooserTest.java @@ -15,7 +15,7 @@ public class FontChooserTest * available, plain) fonts and point sizes that would be rejected by Jalview's * FontChooser as having an I-width of less than 1.0. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void dumpInvalidFonts() { String[] fonts = java.awt.GraphicsEnvironment diff --git a/test/jalview/gui/HelpTest.java b/test/jalview/gui/HelpTest.java index bb538a5..fce2630 100644 --- a/test/jalview/gui/HelpTest.java +++ b/test/jalview/gui/HelpTest.java @@ -14,7 +14,7 @@ import org.testng.annotations.Test; public class HelpTest { - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void checkHelpTargets() throws HelpSetException { ClassLoader cl = Desktop.class.getClassLoader(); diff --git a/test/jalview/gui/JAL1353bugdemo.java b/test/jalview/gui/JAL1353bugdemo.java index e90e3d9..ff8c179 100644 --- a/test/jalview/gui/JAL1353bugdemo.java +++ b/test/jalview/gui/JAL1353bugdemo.java @@ -54,8 +54,7 @@ public class JAL1353bugdemo volatile boolean finish = false; - @Test(groups = - { "Functional" }, enabled = false) + @Test(groups = { "Functional" }, enabled = false) public void test() { Cache.initLogger(); diff --git a/test/jalview/gui/JvSwingUtilsTest.java b/test/jalview/gui/JvSwingUtilsTest.java index eb810e6..2a7f131 100644 --- a/test/jalview/gui/JvSwingUtilsTest.java +++ b/test/jalview/gui/JvSwingUtilsTest.java @@ -10,7 +10,7 @@ import org.testng.annotations.Test; public class JvSwingUtilsTest { - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetScrollBarProportion() { /* diff --git a/test/jalview/gui/PDBSearchPanelTest.java b/test/jalview/gui/PDBSearchPanelTest.java index 7697bda..def61a2 100644 --- a/test/jalview/gui/PDBSearchPanelTest.java +++ b/test/jalview/gui/PDBSearchPanelTest.java @@ -13,7 +13,7 @@ import org.testng.annotations.Test; public class PDBSearchPanelTest { - @BeforeMethod(alwaysRun = true) + @BeforeMethod(alwaysRun = true) public void setUp() throws Exception { } @@ -23,7 +23,7 @@ public class PDBSearchPanelTest { } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void populateCmbSearchTargetOptionsTest() { PDBSearchPanel searchPanel = new PDBSearchPanel(null); @@ -31,7 +31,7 @@ public class PDBSearchPanelTest searchPanel.populateCmbSearchTargetOptions(); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testDecodeSearchTerm() { String expectedString = "1xyz OR text:2xyz OR text:3xyz"; @@ -46,7 +46,7 @@ public class PDBSearchPanelTest assertEquals(expectedString, outcome); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testgetPDBIdwithSpecifiedChain() { @@ -68,8 +68,7 @@ public class PDBSearchPanelTest assertEquals(expectedString, outcome); } - @Test(groups = - { "Network", "External" }, timeOut = 5000) + @Test(groups = { "Network", "External" }, timeOut = 5000) public void txt_search_ActionPerformedTest() { PDBSearchPanel searchPanel = new PDBSearchPanel(null); diff --git a/test/jalview/gui/PaintRefresherTest.java b/test/jalview/gui/PaintRefresherTest.java index 1705e90..b7b21fa 100644 --- a/test/jalview/gui/PaintRefresherTest.java +++ b/test/jalview/gui/PaintRefresherTest.java @@ -22,7 +22,7 @@ import org.testng.annotations.Test; public class PaintRefresherTest { // TODO would prefer PaintRefresher to be a single rather than static - @BeforeMethod(alwaysRun = true) + @BeforeMethod(alwaysRun = true) public void setUp() { PaintRefresher.components.clear(); @@ -34,7 +34,7 @@ public class PaintRefresherTest PaintRefresher.components.clear(); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testRegister() { JPanel jp = new JPanel(); @@ -60,11 +60,11 @@ public class PaintRefresherTest assertTrue(registered.get("44").contains(jp4)); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testRemoveComponent() { Map> registered = PaintRefresher.components; - + // no error with an empty PaintRefresher JPanel jp = new JPanel(); JPanel jp2 = new JPanel(); @@ -92,10 +92,10 @@ public class PaintRefresherTest assertTrue(registered.get("22").contains(jp2)); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetAssociatedPanels() { - SequenceI [] seqs = new SequenceI[]{new Sequence("", "ABC")}; + SequenceI[] seqs = new SequenceI[] { new Sequence("", "ABC") }; Alignment al = new Alignment(seqs); /* @@ -110,7 +110,7 @@ public class PaintRefresherTest .getSequenceSetId()); assertEquals(1, panels.length); assertSame(ap1, panels[0]); - + panels = PaintRefresher.getAssociatedPanels(av.getSequenceSetId() + 1); assertEquals(0, panels.length); } diff --git a/test/jalview/gui/PopupMenuTest.java b/test/jalview/gui/PopupMenuTest.java index 82fcbc8..111f11f 100644 --- a/test/jalview/gui/PopupMenuTest.java +++ b/test/jalview/gui/PopupMenuTest.java @@ -42,7 +42,7 @@ public class PopupMenuTest PopupMenu testee = null; - @BeforeMethod(alwaysRun = true) + @BeforeMethod(alwaysRun = true) public void setUp() throws IOException { alignment = new FormatAdapter().readFile(TEST_DATA, @@ -53,15 +53,15 @@ public class PopupMenuTest int i = 0; for (SequenceI seq : alignment.getSequences()) { - final AlignmentAnnotation annotation = new AlignmentAnnotation("label" + i, - "desc" + i, i); + final AlignmentAnnotation annotation = new AlignmentAnnotation( + "label" + i, "desc" + i, i); annotation.setCalcId("calcId" + i); seq.addAlignmentAnnotation(annotation); annotation.setSequenceRef(seq); } } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testConfigureReferenceAnnotationsMenu_noSequenceSelected() { JMenuItem menu = new JMenuItem(); @@ -79,7 +79,7 @@ public class PopupMenuTest * are no reference annotations to add to the alignment. The menu item should * be disabled. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testConfigureReferenceAnnotationsMenu_noReferenceAnnotations() { JMenuItem menu = new JMenuItem(); @@ -100,7 +100,7 @@ public class PopupMenuTest * reference annotations are already on the alignment. The menu item should be * disabled. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testConfigureReferenceAnnotationsMenu_alreadyAdded() { JMenuItem menu = new JMenuItem(); @@ -120,7 +120,7 @@ public class PopupMenuTest * The menu item should be enabled, and acquire a tooltip which lists the * annotation sources (calcIds) and type (labels). */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testConfigureReferenceAnnotationsMenu() { JMenuItem menu = new JMenuItem(); @@ -143,7 +143,7 @@ public class PopupMenuTest * on the alignment. The menu item should be enabled, and acquire a tooltip * which lists the annotation sources (calcIds) and type (labels). */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testConfigureReferenceAnnotationsMenu_notOnAlignment() { JMenuItem menu = new JMenuItem(); @@ -224,7 +224,7 @@ public class PopupMenuTest * The menu item should be enabled, and acquire a tooltip which lists the * annotation sources (calcIds) and type (labels). */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testConfigureReferenceAnnotationsMenu_twoViews() { } @@ -233,7 +233,7 @@ public class PopupMenuTest * Test for building menu options including 'show' and 'hide' annotation * types. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testBuildAnnotationTypesMenus() { JMenu showMenu = new JMenu(); @@ -244,32 +244,29 @@ public class PopupMenuTest // PDB.secondary structure on Sequence0 AlignmentAnnotation annotation = new AlignmentAnnotation( - "secondary structure", "", new Annotation[] - {}); + "secondary structure", "", new Annotation[] {}); annotation.setCalcId("PDB"); annotation.visible = true; seqs.get(0).addAlignmentAnnotation(annotation); parentPanel.getAlignment().addAnnotation(annotation); // JMOL.secondary structure on Sequence0 - hidden - annotation = new AlignmentAnnotation("secondary structure", "", new Annotation[] - {}); + annotation = new AlignmentAnnotation("secondary structure", "", + new Annotation[] {}); annotation.setCalcId("JMOL"); annotation.visible = false; seqs.get(0).addAlignmentAnnotation(annotation); parentPanel.getAlignment().addAnnotation(annotation); // Jpred.SSP on Sequence0 - hidden - annotation = new AlignmentAnnotation("SSP", "", new Annotation[] - {}); + annotation = new AlignmentAnnotation("SSP", "", new Annotation[] {}); annotation.setCalcId("JPred"); annotation.visible = false; seqs.get(0).addAlignmentAnnotation(annotation); parentPanel.getAlignment().addAnnotation(annotation); // PDB.Temp on Sequence1 - annotation = new AlignmentAnnotation("Temp", "", new Annotation[] - {}); + annotation = new AlignmentAnnotation("Temp", "", new Annotation[] {}); annotation.setCalcId("PDB"); annotation.visible = true; seqs.get(1).addAlignmentAnnotation(annotation); @@ -289,8 +286,7 @@ public class PopupMenuTest assertEquals(4, showOptions.length); // includes 'All' and separator assertEquals(4, hideOptions.length); - assertEquals("All", - ((JMenuItem) showOptions[0]).getText()); + assertEquals("All", ((JMenuItem) showOptions[0]).getText()); assertTrue(showOptions[1] instanceof JPopupMenu.Separator); assertEquals(JSeparator.HORIZONTAL, ((JSeparator) showOptions[1]).getOrientation()); @@ -300,8 +296,7 @@ public class PopupMenuTest assertEquals("SSP", ((JMenuItem) showOptions[3]).getText()); assertEquals("JPred", ((JMenuItem) showOptions[3]).getToolTipText()); - assertEquals("All", - ((JMenuItem) hideOptions[0]).getText()); + assertEquals("All", ((JMenuItem) hideOptions[0]).getText()); assertTrue(hideOptions[1] instanceof JPopupMenu.Separator); assertEquals(JSeparator.HORIZONTAL, ((JSeparator) hideOptions[1]).getOrientation()); @@ -315,7 +310,7 @@ public class PopupMenuTest /** * Test for building menu options with only 'hide' annotation types enabled. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testBuildAnnotationTypesMenus_showDisabled() { JMenu showMenu = new JMenu(); @@ -326,16 +321,14 @@ public class PopupMenuTest // PDB.secondary structure on Sequence0 AlignmentAnnotation annotation = new AlignmentAnnotation( - "secondary structure", "", new Annotation[] - {}); + "secondary structure", "", new Annotation[] {}); annotation.setCalcId("PDB"); annotation.visible = true; seqs.get(0).addAlignmentAnnotation(annotation); parentPanel.getAlignment().addAnnotation(annotation); // PDB.Temp on Sequence1 - annotation = new AlignmentAnnotation("Temp", "", new Annotation[] - {}); + annotation = new AlignmentAnnotation("Temp", "", new Annotation[] {}); annotation.setCalcId("PDB"); annotation.visible = true; seqs.get(1).addAlignmentAnnotation(annotation); @@ -374,7 +367,7 @@ public class PopupMenuTest /** * Test for building menu options with only 'show' annotation types enabled. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testBuildAnnotationTypesMenus_hideDisabled() { JMenu showMenu = new JMenu(); @@ -385,16 +378,14 @@ public class PopupMenuTest // PDB.secondary structure on Sequence0 AlignmentAnnotation annotation = new AlignmentAnnotation( - "secondary structure", "", new Annotation[] - {}); + "secondary structure", "", new Annotation[] {}); annotation.setCalcId("PDB"); annotation.visible = false; seqs.get(0).addAlignmentAnnotation(annotation); parentPanel.getAlignment().addAnnotation(annotation); // PDB.Temp on Sequence1 - annotation = new AlignmentAnnotation("Temp", "", new Annotation[] - {}); + annotation = new AlignmentAnnotation("Temp", "", new Annotation[] {}); annotation.setCalcId("PDB2"); annotation.visible = false; seqs.get(1).addAlignmentAnnotation(annotation); diff --git a/test/jalview/gui/ProgressBarTest.java b/test/jalview/gui/ProgressBarTest.java index e50148c..739b8d8 100644 --- a/test/jalview/gui/ProgressBarTest.java +++ b/test/jalview/gui/ProgressBarTest.java @@ -20,7 +20,7 @@ public class ProgressBarTest private JLabel statusBar; - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testConstructor_prematureInstantiation() { try @@ -33,7 +33,7 @@ public class ProgressBarTest } } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testConstructor_wrongLayout() { statusPanel = new JPanel(); @@ -48,7 +48,7 @@ public class ProgressBarTest } } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testSetProgressBar() { statusPanel = new JPanel(); @@ -61,30 +61,26 @@ public class ProgressBarTest * Add 'hello' */ pb.setProgressBar("hello", 1L); - verifyProgress(layout, new String[] - { "hello" }); + verifyProgress(layout, new String[] { "hello" }); /* * Add 'world' */ pb.setProgressBar("world", 2L); - verifyProgress(layout, new String[] - { "hello", "world" }); + verifyProgress(layout, new String[] { "hello", "world" }); /* * Remove 'hello' with no status bar update */ pb.setProgressBar(null, 1L); - verifyProgress(layout, new String[] - { "world" }); + verifyProgress(layout, new String[] { "world" }); assertEquals("nothing", statusBar.getText()); /* * Remove 'world' with status bar update */ pb.setProgressBar("goodbye", 2L); - verifyProgress(layout, new String[] - {}); + verifyProgress(layout, new String[] {}); assertEquals("goodbye", statusBar.getText()); } diff --git a/test/jalview/gui/SequenceRendererTest.java b/test/jalview/gui/SequenceRendererTest.java index 0f3d4f6..8c5e74f 100644 --- a/test/jalview/gui/SequenceRendererTest.java +++ b/test/jalview/gui/SequenceRendererTest.java @@ -15,12 +15,11 @@ import org.testng.annotations.Test; public class SequenceRendererTest { - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetResidueBoxColour_zappo() { SequenceI seq = new Sequence("name", "MATVLGSPRAPAFF"); // FER1_MAIZE... - AlignmentI al = new Alignment(new SequenceI[] - { seq }); + AlignmentI al = new Alignment(new SequenceI[] { seq }); final AlignViewport av = new AlignViewport(al); SequenceRenderer sr = new SequenceRenderer(av); av.setGlobalColourScheme(new ZappoColourScheme()); diff --git a/test/jalview/gui/StructureChooserTest.java b/test/jalview/gui/StructureChooserTest.java index 71d062c..d1eda0f 100644 --- a/test/jalview/gui/StructureChooserTest.java +++ b/test/jalview/gui/StructureChooserTest.java @@ -18,7 +18,7 @@ public class StructureChooserTest { Sequence seq; - @BeforeMethod(alwaysRun = true) + @BeforeMethod(alwaysRun = true) public void setUp() throws Exception { seq = new Sequence("PDB|4kqy|4KQY|A", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 1, @@ -46,9 +46,7 @@ public class StructureChooserTest seq = null; } - - - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void buildQueryTest() { String query = StructureChooser.buildQuery(seq); @@ -58,13 +56,11 @@ public class StructureChooserTest query); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void populateFilterComboBoxTest() { - SequenceI[] selectedSeqs = new SequenceI[] - { seq }; - StructureChooser sc = new StructureChooser(selectedSeqs, seq, - null); + SequenceI[] selectedSeqs = new SequenceI[] { seq }; + StructureChooser sc = new StructureChooser(selectedSeqs, seq, null); sc.populateFilterComboBox(); int optionsSize = sc.getCmbFilterOption().getItemCount(); assertEquals(3, optionsSize); // if structures are not discovered then don't @@ -77,11 +73,10 @@ public class StructureChooserTest // should be populated } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void fetchStructuresInfoTest() { - SequenceI[] selectedSeqs = new SequenceI[] - { seq }; + SequenceI[] selectedSeqs = new SequenceI[] { seq }; StructureChooser sc = new StructureChooser(selectedSeqs, seq, null); sc.fetchStructuresMetaData(); assertTrue(sc.getDiscoveredStructuresSet() != null); diff --git a/test/jalview/io/AnnotatedPDBFileInputTest.java b/test/jalview/io/AnnotatedPDBFileInputTest.java index 91e816a..f02226e 100644 --- a/test/jalview/io/AnnotatedPDBFileInputTest.java +++ b/test/jalview/io/AnnotatedPDBFileInputTest.java @@ -33,7 +33,7 @@ public class AnnotatedPDBFileInputTest * * @throws Exception */ - @BeforeMethod(alwaysRun = true) + @BeforeMethod(alwaysRun = true) public void setup() throws Exception { Cache.applicationProperties.setProperty("STRUCT_FROM_PDB", @@ -48,7 +48,7 @@ public class AnnotatedPDBFileInputTest .get(0).getId(); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void checkNoDuplicates() { // not strictly a requirement, but strange things may happen if multiple @@ -61,14 +61,13 @@ public class AnnotatedPDBFileInputTest { for (int q = p + 1; q < avec.length; q++) { - Assert.assertNotEquals( - "Found a duplicate annotation row " + avec[p].label, - avec[p], avec[q]); + Assert.assertNotEquals("Found a duplicate annotation row " + + avec[p].label, avec[p], avec[q]); } } } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void checkPDBannotationSource() { @@ -86,7 +85,7 @@ public class AnnotatedPDBFileInputTest /** * Check sequence features have been added */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void checkPDBSequenceFeatures() { /* @@ -120,7 +119,7 @@ public class AnnotatedPDBFileInputTest assertEquals("TYR: 314 1gaqC", sf[295].getDescription()); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void checkAnnotationWiring() { assertTrue(al.getAlignmentAnnotation() != null); @@ -169,7 +168,7 @@ public class AnnotatedPDBFileInputTest } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testJalviewProjectRelocationAnnotation() throws Exception { @@ -194,7 +193,8 @@ public class AnnotatedPDBFileInputTest sq = sq.getDatasetSequence(); } assertNotNull(sq.getAllPDBEntries()); - assertEquals("Expected only one PDB ID", sq.getAllPDBEntries().size(), 1); + assertEquals("Expected only one PDB ID", + sq.getAllPDBEntries().size(), 1); for (PDBEntry pdbentry : sq.getAllPDBEntries()) { System.err.println("PDB Entry " + pdbentry.getId() + " " @@ -207,8 +207,7 @@ public class AnnotatedPDBFileInputTest && MCview.PDBfile.isCalcIdHandled(ana.getCalcId())) { exists = true; - if (MCview.PDBfile.isCalcIdForFile(ana, - pdbentry.getId())) + if (MCview.PDBfile.isCalcIdForFile(ana, pdbentry.getId())) { found = true; } diff --git a/test/jalview/io/AnnotationFileIOTest.java b/test/jalview/io/AnnotationFileIOTest.java index a63923a..d757a6a 100644 --- a/test/jalview/io/AnnotationFileIOTest.java +++ b/test/jalview/io/AnnotationFileIOTest.java @@ -36,8 +36,7 @@ import org.testng.annotations.Test; public class AnnotationFileIOTest { - static String TestFiles[][] = - { + static String TestFiles[][] = { { "Test example annotation import/export", "examples/uniref50.fa", "examples/testdata/example_annot_file.jva" }, { "Test multiple combine annotation statements import/export", @@ -52,7 +51,7 @@ public class AnnotationFileIOTest { "Test hiding/showing of insertions on sequence_ref", "examples/uniref50.fa", "examples/testdata/uniref50_seqref.jva" } }; - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void exampleAnnotationFileIO() throws Exception { for (String[] testPair : TestFiles) diff --git a/test/jalview/io/BioJsHTMLOutputTest.java b/test/jalview/io/BioJsHTMLOutputTest.java index 2d49bf7..4372f30 100644 --- a/test/jalview/io/BioJsHTMLOutputTest.java +++ b/test/jalview/io/BioJsHTMLOutputTest.java @@ -15,11 +15,10 @@ import org.testng.Assert; import org.testng.AssertJUnit; import org.testng.annotations.Test; - public class BioJsHTMLOutputTest { - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void getJalviewAlignmentAsJsonString() { String bjsTemplate = null; @@ -44,8 +43,9 @@ public class BioJsHTMLOutputTest Assert.assertNotNull(bjsTemplate); } - @Test(groups = - { "Functional" }, expectedExceptions = NullPointerException.class) + @Test( + groups = { "Functional" }, + expectedExceptions = NullPointerException.class) public void expectedNullPointerException() { try @@ -58,7 +58,7 @@ public class BioJsHTMLOutputTest } } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void getBioJsMSAVersions() { TreeMap versions = null; @@ -73,10 +73,10 @@ public class BioJsHTMLOutputTest e.printStackTrace(); } AssertJUnit.assertNotNull("No versions found", versions); - AssertJUnit.assertTrue("One or more Templates required", versions.size() > 0); + AssertJUnit.assertTrue("One or more Templates required", + versions.size() > 0); System.out - .println("Number of discovered versions : " - + versions.size()); + .println("Number of discovered versions : " + versions.size()); for (String v : versions.keySet()) { System.out.println("version : " + v); @@ -90,18 +90,17 @@ public class BioJsHTMLOutputTest } - @Test(groups = - { "Network" }) + @Test(groups = { "Network" }) public void testBioJsUpdate() { String url = BioJsHTMLOutput.BJS_TEMPLATE_GIT_REPO; - AssertJUnit.assertTrue("URL not reacable : " + url, urlIsReachable(url)); + AssertJUnit + .assertTrue("URL not reacable : " + url, urlIsReachable(url)); String response = BioJsHTMLOutput.getURLContentAsString(url); AssertJUnit.assertNotNull("Null response read from url!", response); BioJSRepositoryPojo repository = new BioJSRepositoryPojo(response); System.out.println(">>> description : " + repository.getDescription()); - System.out -.println(">>> latest version : " + System.out.println(">>> latest version : " + repository.getLatestReleaseVersion()); System.out.println(">>> repo count : " + repository.getReleases().size()); diff --git a/test/jalview/io/FileIOTester.java b/test/jalview/io/FileIOTester.java index 2404ea9..fef7173 100644 --- a/test/jalview/io/FileIOTester.java +++ b/test/jalview/io/FileIOTester.java @@ -67,13 +67,14 @@ public class FileIOTester private void assertValidFormat(String fmt, String src, FileParse fp) { - AssertJUnit.assertTrue("Couldn't resolve " + src + " as a valid file", fp.isValid()); + AssertJUnit.assertTrue("Couldn't resolve " + src + " as a valid file", + fp.isValid()); String type = new IdentifyFile().Identify(fp); AssertJUnit.assertTrue("Data from '" + src + "' Expected to be '" + fmt + "' identified as '" + type + "'", type.equalsIgnoreCase(fmt)); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testStarsInFasta1() throws IOException { String uri; @@ -82,7 +83,7 @@ public class FileIOTester assertValidFormat("FASTA", uri, fp); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testStarsInFasta2() throws IOException { String uri; @@ -91,7 +92,7 @@ public class FileIOTester assertValidFormat("FASTA", uri, fp); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGzipIo() throws IOException { String uri; @@ -100,7 +101,7 @@ public class FileIOTester assertValidFormat("FASTA", uri, fp); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGziplocalFileIO() throws IOException { String filepath; @@ -109,7 +110,7 @@ public class FileIOTester assertValidFormat("FASTA", filepath, fp); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testNonGzipURLIO() throws IOException { String uri; @@ -118,7 +119,7 @@ public class FileIOTester assertValidFormat("FASTA", uri, fp); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testNonGziplocalFileIO() throws IOException { String filepath; diff --git a/test/jalview/io/Gff3tests.java b/test/jalview/io/Gff3tests.java index c8cf638..54e4d58 100644 --- a/test/jalview/io/Gff3tests.java +++ b/test/jalview/io/Gff3tests.java @@ -23,7 +23,7 @@ public class Gff3tests exonerateOutput = "examples/testdata/exonerateoutput.gff", simpleGff3file = "examples/testdata/simpleGff3.gff"; - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testExonerateImport() { // exonerate does not tag sequences after features, so we have a more @@ -34,8 +34,8 @@ public class Gff3tests AlignFrame af = loader.LoadFileWaitTillLoaded(exonerateSeqs, FormatAdapter.FILE); - assertEquals("Unexpected number of DNA protein associations", 0, - af.getViewport().getAlignment().getCodonFrames().size()); + assertEquals("Unexpected number of DNA protein associations", 0, af + .getViewport().getAlignment().getCodonFrames().size()); af.loadJalviewDataFile(exonerateOutput, FormatAdapter.FILE, null, null); @@ -45,19 +45,17 @@ public class Gff3tests } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void simpleGff3FileIdentify() { - assertEquals("Didn't recognise file correctly.", - IdentifyFile.GFF3File, + assertEquals("Didn't recognise file correctly.", IdentifyFile.GFF3File, new IdentifyFile().Identify(simpleGff3file, FormatAdapter.FILE)); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void simpleGff3FileClass() throws IOException { - AlignmentI dataset = new Alignment(new SequenceI[] - {}); + AlignmentI dataset = new Alignment(new SequenceI[] {}); FeaturesFile ffile = new FeaturesFile(simpleGff3file, FormatAdapter.FILE); @@ -66,7 +64,7 @@ public class Gff3tests checkDatasetfromSimpleGff3(dataset); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void simpleGff3FileLoader() throws IOException { AlignFrame af = new FileLoader(false).LoadFileWaitTillLoaded( @@ -77,11 +75,10 @@ public class Gff3tests checkDatasetfromSimpleGff3(af.getViewport().getAlignment().getDataset()); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void simpleGff3RelaxedIdMatching() throws IOException { - AlignmentI dataset = new Alignment(new SequenceI[] - {}); + AlignmentI dataset = new Alignment(new SequenceI[] {}); FeaturesFile ffile = new FeaturesFile(simpleGff3file, FormatAdapter.FILE); @@ -91,7 +88,7 @@ public class Gff3tests checkDatasetfromSimpleGff3(dataset); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void readGff3File() throws IOException { Gff3File gff3reader = new Gff3File(simpleGff3file, FormatAdapter.FILE); @@ -123,17 +120,16 @@ public class Gff3tests placeholderseq.equals(seq1.getSequenceAsString())); assertFalse("dummy replacement buggy for seq2", placeholderseq.equals(seq2.getSequenceAsString())); - assertNotNull("No features added to seq1", - seq1.getSequenceFeatures());// != null); + assertNotNull("No features added to seq1", seq1.getSequenceFeatures());// != + // null); assertEquals("Wrong number of features", 3, seq1.getSequenceFeatures().length); assertNull(seq2.getSequenceFeatures()); assertEquals( "Wrong number of features", 0, - seq2 - .getSequenceFeatures() == null ? 0 - : seq2.getSequenceFeatures().length); + seq2.getSequenceFeatures() == null ? 0 : seq2 + .getSequenceFeatures().length); assertTrue( "Expected at least one CDNA/Protein mapping for seq1", dataset.getCodonFrame(seq1) != null diff --git a/test/jalview/io/HtmlFileTest.java b/test/jalview/io/HtmlFileTest.java index 10d1057..ce4aecc 100644 --- a/test/jalview/io/HtmlFileTest.java +++ b/test/jalview/io/HtmlFileTest.java @@ -7,8 +7,7 @@ import org.testng.annotations.Test; public class HtmlFileTest { - @Test(groups = - { "Functional" }, enabled = false) + @Test(groups = { "Functional" }, enabled = false) public void test() { fail("Not yet implemented"); diff --git a/test/jalview/io/IdentifyFileTest.java b/test/jalview/io/IdentifyFileTest.java index 233358f..85410d1 100644 --- a/test/jalview/io/IdentifyFileTest.java +++ b/test/jalview/io/IdentifyFileTest.java @@ -4,10 +4,10 @@ import org.testng.Assert; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -public class IdentifyFileTest { +public class IdentifyFileTest +{ - @Test(groups = - { "Functional" }, dataProvider = "identifyFiles") + @Test(groups = { "Functional" }, dataProvider = "identifyFiles") public void Identify(String data, String expectedFileType) { String protocol = AppletFormatAdapter.FILE; @@ -20,8 +20,7 @@ public class IdentifyFileTest { @DataProvider(name = "identifyFiles") public Object[][] IdentifyFileDP() { - return new Object[][] - { + return new Object[][] { { "examples/example.json", "JSON" }, { "examples/plantfdx.fa", "FASTA" }, { "examples/dna_interleaved.phy", "PHYLIP" }, diff --git a/test/jalview/io/JSONFileTest.java b/test/jalview/io/JSONFileTest.java index 0b9f30a..fccd94a 100644 --- a/test/jalview/io/JSONFileTest.java +++ b/test/jalview/io/JSONFileTest.java @@ -1,6 +1,5 @@ package jalview.io; - import static org.testng.AssertJUnit.assertNotNull; import jalview.api.AlignExportSettingI; @@ -93,7 +92,6 @@ public class JSONFileTest seqs[3].addSequenceFeature(seqFeature3); seqs[4].addSequenceFeature(seqFeature4); - for (Sequence seq : seqs) { seq.setDatasetSequence(seq); @@ -217,7 +215,6 @@ public class JSONFileTest af.changeColour(jf.getColourScheme()); af.getViewport().setFeaturesDisplayed(jf.getDisplayedFeatures()); - formatAdapter = new AppletFormatAdapter(af.alignPanel, exportSettings); String jsonOutput = formatAdapter.formatSequences(JSONFile.FILE_DESC, af.alignPanel.getAlignment(), false); @@ -234,7 +231,7 @@ public class JSONFileTest } - @BeforeMethod(alwaysRun = true) + @BeforeMethod(alwaysRun = true) public void methodSetup() { passedCount = 0; @@ -252,13 +249,13 @@ public class JSONFileTest jf = null; } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void roundTripTest() { assertNotNull("JSON roundtrip test failed!", testJsonFile); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testSeqParsed() { assertNotNull("Couldn't read supplied alignment data.", testAlignment); @@ -274,8 +271,8 @@ public class JSONFileTest AssertJUnit.assertEquals("Some Sequences did not pass the test", TEST_SEQ_HEIGHT, passedCount); } - - @Test(groups ={ "Functional" }) + + @Test(groups = { "Functional" }) public void hiddenColsTest() { ColumnSelection cs = testJsonFile.getColumnSelection(); @@ -287,16 +284,15 @@ public class JSONFileTest "Mismatched hidden columns!"); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void hiddenSeqsTest() { Assert.assertNotNull(testJsonFile.getHiddenSequences(), "Hidden sequence Expected but found Null"); - Assert.assertEquals(jf.getHiddenSequences().length, 1, - "Hidden sequece"); + Assert.assertEquals(jf.getHiddenSequences().length, 1, "Hidden sequece"); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void colorSchemeTest() { Assert.assertNotNull(testJsonFile.getColourScheme(), @@ -306,14 +302,14 @@ public class JSONFileTest "Zappo colour scheme expected!"); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void isShowSeqFeaturesSet() { Assert.assertTrue(testJsonFile.isShowSeqFeatures(), "Sequence feature isDisplayed setting expected to be true"); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGrpParsed() { Assert.assertNotNull(testAlignment.getGroups()); @@ -329,7 +325,7 @@ public class JSONFileTest TEST_GRP_HEIGHT, passedCount); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testAnnotationParsed() { Assert.assertNotNull(testAlignment.getAlignmentAnnotation()); diff --git a/test/jalview/io/Jalview2xmlTests.java b/test/jalview/io/Jalview2xmlTests.java index 982be0c..3c634fd 100644 --- a/test/jalview/io/Jalview2xmlTests.java +++ b/test/jalview/io/Jalview2xmlTests.java @@ -51,8 +51,8 @@ public class Jalview2xmlTests @BeforeClass(alwaysRun = true) public static void setUpBeforeClass() throws Exception { - jalview.bin.Jalview.main(new String[] - { "-props", "test/jalview/io/testProps.jvprops" }); + jalview.bin.Jalview.main(new String[] { "-props", + "test/jalview/io/testProps.jvprops" }); } /** @@ -84,7 +84,7 @@ public class Jalview2xmlTests return numdsann; } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testRNAStructureRecovery() throws Exception { String inFile = "examples/RF00031_folded.stk"; @@ -119,7 +119,7 @@ public class Jalview2xmlTests af.getViewport().getGlobalColourScheme() instanceof jalview.schemes.RNAHelicesColour); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testTCoffeeScores() throws Exception { String inFile = "examples/uniref50.fa", inAnnot = "examples/uniref50.score_ascii"; @@ -155,7 +155,7 @@ public class Jalview2xmlTests .println("T-Coffee score shading successfully recovered from project."); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testColourByAnnotScores() throws Exception { String inFile = "examples/uniref50.fa", inAnnot = "examples/testdata/uniref50_iupred.jva"; @@ -241,7 +241,7 @@ public class Jalview2xmlTests .println("Per sequence (Group) colourscheme successfully applied and recovered."); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void gatherViewsHere() throws Exception { int origCount = Desktop.getAlignFrames() == null ? 0 : Desktop @@ -254,7 +254,7 @@ public class Jalview2xmlTests } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void viewRefPdbAnnotation() throws Exception { Cache.applicationProperties.setProperty("STRUCT_FROM_PDB", @@ -276,7 +276,8 @@ public class Jalview2xmlTests assertTrue("Couldn't find the structure view", sps != null); SequenceI sq = sps.getAlignment().findName("1A70|"); AlignmentAnnotation refan = null; - for (AlignmentAnnotation ra:sps.getAlignment().getAlignmentAnnotation()) + for (AlignmentAnnotation ra : sps.getAlignment() + .getAlignmentAnnotation()) { if (ra.graph != 0) { @@ -284,7 +285,7 @@ public class Jalview2xmlTests break; } } - assertTrue("Annotation secondary structure not found.",refan!=null); + assertTrue("Annotation secondary structure not found.", refan != null); assertTrue("Couldn't find 1a70 null chain", sq != null); // compare the manually added temperature factor annotation // to the track automatically transferred from the pdb structure on load @@ -298,25 +299,25 @@ public class Jalview2xmlTests for (int p = 0; p < ala.annotations.length; p++) { sq.findPosition(p); - try { + try + { assertTrue( "Mismatch at alignment position " + p, - (alaa.annotations[p] == null && refan.annotations[p] == null) + (alaa.annotations[p] == null && refan.annotations[p] == null) || alaa.annotations[p].value == refan.annotations[p].value); - } - catch (NullPointerException q) + } catch (NullPointerException q) { - Assert.fail("Mismatch of alignment annotations at position " + p - + " Ref seq ann: " + refan.annotations[p] + Assert.fail("Mismatch of alignment annotations at position " + + p + " Ref seq ann: " + refan.annotations[p] + " alignment " + alaa.annotations[p]); } - } + } } } - + } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testCopyViewSettings() throws Exception { AlignFrame af = new jalview.io.FileLoader().LoadFileWaitTillLoaded( @@ -350,18 +351,16 @@ public class Jalview2xmlTests } /** - * test store and recovery of expanded views - - * currently this is disabled since the - * Desktop.explodeViews method doesn't seem - * to result in the views being expanded to - * distinct align frames when executed programmatically. + * test store and recovery of expanded views - currently this is disabled + * since the Desktop.explodeViews method doesn't seem to result in the views + * being expanded to distinct align frames when executed programmatically. + * * @throws Exception */ @Test(groups = { "Functional" }, enabled = false) public void testStoreAndRecoverExpandedviews() throws Exception { - AlignFrame af = new jalview.io.FileLoader() - .LoadFileWaitTillLoaded( + AlignFrame af = new jalview.io.FileLoader().LoadFileWaitTillLoaded( "examples/exampleFile_2_7.jar", FormatAdapter.FILE); assertTrue("Didn't read in the example file correctly.", af != null); String afid = af.getViewport().getSequenceSetId(); @@ -369,12 +368,12 @@ public class Jalview2xmlTests final AlignFrame xaf = af; af = null; new Thread(new Runnable() - { - @Override - public void run() { + @Override + public void run() + { Desktop.instance.explodeViews(xaf); - } + } }).start(); Thread.sleep(1000); } @@ -384,8 +383,7 @@ public class Jalview2xmlTests // Thread.sleep(300); // } int oldviews = Desktop.getAlignFrames().length; - Assert.assertEquals( - Desktop.getAlignFrames().length, + Assert.assertEquals(Desktop.getAlignFrames().length, Desktop.getAlignmentPanels(afid).length); File tfile = File.createTempFile("testStoreAndRecoverExpanded", ".jvp"); try @@ -406,9 +404,11 @@ public class Jalview2xmlTests af = new jalview.io.FileLoader().LoadFileWaitTillLoaded( tfile.getAbsolutePath(), FormatAdapter.FILE); Assert.assertNotNull(af); - Assert.assertEquals(Desktop.getAlignFrames().length, + Assert.assertEquals( + Desktop.getAlignFrames().length, Desktop.getAlignmentPanels(af.getViewport().getSequenceSetId()).length); - Assert.assertEquals(oldviews, + Assert.assertEquals( + oldviews, Desktop.getAlignmentPanels(af.getViewport().getSequenceSetId()).length); } diff --git a/test/jalview/io/JalviewExportPropertiesTests.java b/test/jalview/io/JalviewExportPropertiesTests.java index faf4ef9..ab3d9df 100644 --- a/test/jalview/io/JalviewExportPropertiesTests.java +++ b/test/jalview/io/JalviewExportPropertiesTests.java @@ -45,8 +45,8 @@ public class JalviewExportPropertiesTests @BeforeClass(alwaysRun = true) public static void setUpBeforeClass() throws Exception { - jalview.bin.Jalview.main(new String[] - { "-props", "test/jalview/io/testProps.jvprops" }); + jalview.bin.Jalview.main(new String[] { "-props", + "test/jalview/io/testProps.jvprops" }); } /** @@ -58,7 +58,8 @@ public class JalviewExportPropertiesTests jalview.gui.Desktop.instance.closeAll_actionPerformed(null); } - @Test(groups ={ "Functional" }) + + @Test(groups = { "Functional" }) public void testImportExportPeriodGaps() throws Exception { jalview.bin.Cache.setProperty("GAP_SYMBOL", "."); @@ -71,8 +72,8 @@ public class JalviewExportPropertiesTests .getAlignment().getSequenceAt(0).getCharAt(5) == '.'); SequenceGroup sg = new SequenceGroup(); - sg.addSequence(af.getViewport().getAlignment().getSequenceAt(0),false); - sg.addSequence(af.getViewport().getAlignment().getSequenceAt(1),false); + sg.addSequence(af.getViewport().getAlignment().getSequenceAt(0), false); + sg.addSequence(af.getViewport().getAlignment().getSequenceAt(1), false); sg.setStartRes(1); sg.setEndRes(7); af.getViewport().setSelectionGroup(sg); diff --git a/test/jalview/io/NewickFileTests.java b/test/jalview/io/NewickFileTests.java index 261ffc6..d8e21c4 100644 --- a/test/jalview/io/NewickFileTests.java +++ b/test/jalview/io/NewickFileTests.java @@ -56,19 +56,15 @@ public class NewickFileTests public static Collection data() { return Arrays - .asList(new Object[][] - { + .asList(new Object[][] { - new String[] - { + new String[] { "Simple uniref50 newick", "(((FER_BRANA:128.0,FER3_RAPSA:128.0):50.75,FER_CAPAA:178.75):121.94443,(Q93Z60_ARATH:271.45456,((O80429_MAIZE:183.0,FER1_MAIZE:183.0):30.5,((Q7XA98_TRIPR:90.0,FER1_PEA:90.0):83.32143,(((FER2_ARATH:64.0,FER1_ARATH:64.0):94.375,(FER1_SPIOL:124.5,FER1_MESCR:124.5):33.875):6.4166718,((Q93XJ9_SOLTU:33.5,FER1_SOLLC:33.5):49.0,FER_CAPAN:82.5):82.29167):8.529755):40.178574):57.95456):29.239868);" }, - new String[] - { + new String[] { "Tree with quotes", "('Syn_PROSU-1_IIh_3d(CA4)|CK_Syn_PROSU-1_1907':1.0638313,'Syn_MINOS11_5.3_3d(CA4)|CK_Syn_MINOS11_750':1.063831);" }, - new String[] - { + new String[] { "Tree with double escaped comma in node", "('Syn_PROSU-1_IIh_3d(CA4)|CK_Syn_PROSU-1_1907':1.0638313,'Syn_MINOS11_5.3_3d(CA4)''|CK_Syn_MINOS11_750':1.063831);" } }); }; @@ -89,7 +85,7 @@ public class NewickFileTests { } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testTreeIO() throws Exception { String stage = "Init", treename = " '" + name + "' :"; @@ -99,15 +95,16 @@ public class NewickFileTests System.out.println(treename + "\n" + testTree); NewickFile nf = new NewickFile(testTree, FormatAdapter.PASTE); nf.parse(); - AssertJUnit.assertTrue(stage + "Invalid Tree '" + nf.getWarningMessage() + "'", + AssertJUnit.assertTrue( + stage + "Invalid Tree '" + nf.getWarningMessage() + "'", nf.isValid()); SequenceNode tree = nf.getTree(); AssertJUnit.assertTrue(stage + "Null Tree", tree != null); stage = "Creating newick file from testTree " + treename; String gentree = new NewickFile(tree).print(nf.HasBootstrap(), nf.HasDistances()); - AssertJUnit.assertTrue(stage + "Empty string generated", gentree != null - && gentree.trim().length() > 0); + AssertJUnit.assertTrue(stage + "Empty string generated", + gentree != null && gentree.trim().length() > 0); stage = "Parsing regenerated testTree " + treename; NewickFile nf_regen = new NewickFile(gentree, FormatAdapter.PASTE); nf_regen.parse(); @@ -122,7 +119,8 @@ public class NewickFileTests Vector oseqs, nseqs; oseqs = new NJTree(new SequenceI[0], nf).findLeaves(nf.getTree(), new Vector()); - AssertJUnit.assertTrue(stage + "No nodes in original tree.", oseqs.size() > 0); + AssertJUnit.assertTrue(stage + "No nodes in original tree.", + oseqs.size() > 0); SequenceI[] olsqs = new SequenceI[oseqs.size()]; for (int i = 0, iSize = oseqs.size(); i < iSize; i++) { @@ -130,14 +128,16 @@ public class NewickFileTests } nseqs = new NJTree(new SequenceI[0], nf_regen).findLeaves( nf_regen.getTree(), new Vector()); - AssertJUnit.assertTrue(stage + "No nodes in regerated tree.", nseqs.size() > 0); + AssertJUnit.assertTrue(stage + "No nodes in regerated tree.", + nseqs.size() > 0); SequenceI[] nsqs = new SequenceI[nseqs.size()]; for (int i = 0, iSize = nseqs.size(); i < iSize; i++) { nsqs[i] = (SequenceI) ((SequenceNode) nseqs.get(i)).element(); } - AssertJUnit.assertTrue(stage + " Different number of leaves (original " - + olsqs.length + " and regen " + nsqs.length + ")", + AssertJUnit.assertTrue(stage + + " Different number of leaves (original " + olsqs.length + + " and regen " + nsqs.length + ")", olsqs.length == nsqs.length); SequenceIdMatcher omatcher = new SequenceIdMatcher(olsqs), nmatcher = new SequenceIdMatcher( nsqs); diff --git a/test/jalview/io/PhylipFileTests.java b/test/jalview/io/PhylipFileTests.java index 9c95486..494b7a2 100644 --- a/test/jalview/io/PhylipFileTests.java +++ b/test/jalview/io/PhylipFileTests.java @@ -79,7 +79,7 @@ public class PhylipFileTests * * @throws Exception */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testSequentialDataExtraction() throws Exception { testDataExtraction(sequentialFile); @@ -91,7 +91,7 @@ public class PhylipFileTests * * @throws Exception */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testInterleavedDataExtraction() throws Exception { testDataExtraction(interleavedFile); @@ -124,7 +124,7 @@ public class PhylipFileTests * * @throws Exception */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testSequentialIO() throws Exception { testIO(sequentialFile); @@ -136,7 +136,7 @@ public class PhylipFileTests * * @throws Exception */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testInterleavedIO() throws Exception { testIO(interleavedFile); diff --git a/test/jalview/io/RNAMLfileTest.java b/test/jalview/io/RNAMLfileTest.java index fc54ef1..d41446b 100644 --- a/test/jalview/io/RNAMLfileTest.java +++ b/test/jalview/io/RNAMLfileTest.java @@ -39,7 +39,7 @@ public class RNAMLfileTest { } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testRnamlToStockholmIO() { StockholmFileTest.testFileIOwithFormat(new File( diff --git a/test/jalview/io/StockholmFileTest.java b/test/jalview/io/StockholmFileTest.java index 7ef5cc6..e889837 100644 --- a/test/jalview/io/StockholmFileTest.java +++ b/test/jalview/io/StockholmFileTest.java @@ -43,13 +43,13 @@ public class StockholmFileTest static String PfamFile = "examples/PF00111_seed.stk", RfamFile = "examples/RF00031_folded.stk"; - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void pfamFileIO() throws Exception { testFileIOwithFormat(new File(PfamFile), "STH", -1, 0); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void pfamFileDataExtraction() throws Exception { AppletFormatAdapter af = new AppletFormatAdapter(); @@ -68,7 +68,7 @@ public class StockholmFileTest numpdb > 0); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void rfamFileIO() throws Exception { testFileIOwithFormat(new File(RfamFile), "STH", 2, 1); @@ -136,7 +136,7 @@ public class StockholmFileTest if (naliannot > -1) { assertEquals("Number of alignment annotations", naliannot, - numaliannot); + numaliannot); } assertTrue( @@ -268,7 +268,7 @@ public class StockholmFileTest + (ignoreFeatures ? " ignoring." : ""), ignoreFeatures || (seq_original[i].getSequenceFeatures() == null && seq_new[in] - .getSequenceFeatures() == null) + .getSequenceFeatures() == null) || (seq_original[i].getSequenceFeatures() != null && seq_new[in] .getSequenceFeatures() != null)); // compare sequence features diff --git a/test/jalview/io/TCoffeeScoreFileTest.java b/test/jalview/io/TCoffeeScoreFileTest.java index 7911188..181aabd 100644 --- a/test/jalview/io/TCoffeeScoreFileTest.java +++ b/test/jalview/io/TCoffeeScoreFileTest.java @@ -40,19 +40,21 @@ public class TCoffeeScoreFileTest final static File ALIGN_FILE = new File( "test/jalview/io/tcoffee.fasta_aln"); - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testReadHeader() throws IOException { TCoffeeScoreFile scoreFile = new TCoffeeScoreFile(SCORE_FILE.getPath(), AppletFormatAdapter.FILE); - AssertJUnit.assertTrue(scoreFile.getWarningMessage(), scoreFile.isValid()); + AssertJUnit.assertTrue(scoreFile.getWarningMessage(), + scoreFile.isValid()); Header header = scoreFile.header; AssertJUnit.assertNotNull(header); - AssertJUnit.assertEquals( - "T-COFFEE, Version_9.02.r1228 (2012-02-16 18:15:12 - Revision 1228 - Build 336)", - header.head); + AssertJUnit + .assertEquals( + "T-COFFEE, Version_9.02.r1228 (2012-02-16 18:15:12 - Revision 1228 - Build 336)", + header.head); AssertJUnit.assertEquals(90, header.score); AssertJUnit.assertEquals(89, header.getScoreFor("1PHT")); AssertJUnit.assertEquals(90, header.getScoreFor("1BB9")); @@ -65,7 +67,7 @@ public class TCoffeeScoreFileTest AssertJUnit.assertEquals(90, header.getScoreFor("cons")); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testWrongFile() { try @@ -80,7 +82,7 @@ public class TCoffeeScoreFileTest } } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testHeightAndWidth() throws IOException { TCoffeeScoreFile result = new TCoffeeScoreFile(SCORE_FILE.getPath(), @@ -90,7 +92,7 @@ public class TCoffeeScoreFileTest AssertJUnit.assertEquals(83, result.getWidth()); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testReadBlock() throws IOException { @@ -109,63 +111,81 @@ public class TCoffeeScoreFileTest Block block = TCoffeeScoreFile.readBlock(source, 0); AssertJUnit.assertNotNull(block); - AssertJUnit.assertEquals("999999999999999999999999998762112222543211112134", + AssertJUnit.assertEquals( + "999999999999999999999999998762112222543211112134", block.getScoresFor("1PHT")); - AssertJUnit.assertEquals("99999999999999999999999999987-------4322----2234", + AssertJUnit.assertEquals( + "99999999999999999999999999987-------4322----2234", block.getScoresFor("1BB9")); - AssertJUnit.assertEquals("99999999999999999999999999987-------5321----2246", + AssertJUnit.assertEquals( + "99999999999999999999999999987-------5321----2246", block.getScoresFor("1UHC")); - AssertJUnit.assertEquals("99999999999999999999999999986-------4321----1-35", + AssertJUnit.assertEquals( + "99999999999999999999999999986-------4321----1-35", block.getScoresFor("1YCS")); - AssertJUnit.assertEquals("999999999999999999999999999861-------3------1135", + AssertJUnit.assertEquals( + "999999999999999999999999999861-------3------1135", block.getScoresFor("1OOT")); - AssertJUnit.assertEquals("99999999999999999999999999986-------422-------34", + AssertJUnit.assertEquals( + "99999999999999999999999999986-------422-------34", block.getScoresFor("1ABO")); - AssertJUnit.assertEquals("99999999999999999999999999985-------32--------35", + AssertJUnit.assertEquals( + "99999999999999999999999999985-------32--------35", block.getScoresFor("1FYN")); - AssertJUnit.assertEquals("99999999999999999999999999974-------2---------24", + AssertJUnit.assertEquals( + "99999999999999999999999999974-------2---------24", block.getScoresFor("1QCF")); - AssertJUnit.assertEquals("999999999999999999999999999851000110321100001134", + AssertJUnit.assertEquals( + "999999999999999999999999999851000110321100001134", block.getConsensus()); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testParse() throws IOException { TCoffeeScoreFile parser = new TCoffeeScoreFile(SCORE_FILE.getPath(), FormatAdapter.FILE); - AssertJUnit.assertEquals( - "999999999999999999999999998762112222543211112134----------5666642367889999999999889", - parser.getScoresFor("1PHT")); - AssertJUnit.assertEquals( - "99999999999999999999999999987-------4322----22341111111111676653-355679999999999889", - parser.getScoresFor("1BB9")); - AssertJUnit.assertEquals( - "99999999999999999999999999987-------5321----2246----------788774--66789999999999889", - parser.getScoresFor("1UHC")); - AssertJUnit.assertEquals( - "99999999999999999999999999986-------4321----1-35----------78777--356789999999999889", - parser.getScoresFor("1YCS")); - AssertJUnit.assertEquals( - "999999999999999999999999999861-------3------1135----------78877--356789999999997-67", - parser.getScoresFor("1OOT")); - AssertJUnit.assertEquals( - "99999999999999999999999999986-------422-------34----------687774--56779999999999889", - parser.getScoresFor("1ABO")); - AssertJUnit.assertEquals( - "99999999999999999999999999985-------32--------35----------6888842356789999999999889", - parser.getScoresFor("1FYN")); - AssertJUnit.assertEquals( - "99999999999999999999999999974-------2---------24----------6878742356789999999999889", - parser.getScoresFor("1QCF")); - AssertJUnit.assertEquals( - "99999999999999999999999999985100011032110000113400100000006877641356789999999999889", - parser.getScoresFor("cons")); + AssertJUnit + .assertEquals( + "999999999999999999999999998762112222543211112134----------5666642367889999999999889", + parser.getScoresFor("1PHT")); + AssertJUnit + .assertEquals( + "99999999999999999999999999987-------4322----22341111111111676653-355679999999999889", + parser.getScoresFor("1BB9")); + AssertJUnit + .assertEquals( + "99999999999999999999999999987-------5321----2246----------788774--66789999999999889", + parser.getScoresFor("1UHC")); + AssertJUnit + .assertEquals( + "99999999999999999999999999986-------4321----1-35----------78777--356789999999999889", + parser.getScoresFor("1YCS")); + AssertJUnit + .assertEquals( + "999999999999999999999999999861-------3------1135----------78877--356789999999997-67", + parser.getScoresFor("1OOT")); + AssertJUnit + .assertEquals( + "99999999999999999999999999986-------422-------34----------687774--56779999999999889", + parser.getScoresFor("1ABO")); + AssertJUnit + .assertEquals( + "99999999999999999999999999985-------32--------35----------6888842356789999999999889", + parser.getScoresFor("1FYN")); + AssertJUnit + .assertEquals( + "99999999999999999999999999974-------2---------24----------6878742356789999999999889", + parser.getScoresFor("1QCF")); + AssertJUnit + .assertEquals( + "99999999999999999999999999985100011032110000113400100000006877641356789999999999889", + parser.getScoresFor("cons")); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetAsList() throws IOException { @@ -173,37 +193,46 @@ public class TCoffeeScoreFileTest FormatAdapter.FILE); AssertJUnit.assertTrue(parser.getWarningMessage(), parser.isValid()); List scores = parser.getScoresList(); - AssertJUnit.assertEquals( - "999999999999999999999999998762112222543211112134----------5666642367889999999999889", - scores.get(0)); - AssertJUnit.assertEquals( - "99999999999999999999999999987-------4322----22341111111111676653-355679999999999889", - scores.get(1)); - AssertJUnit.assertEquals( - "99999999999999999999999999987-------5321----2246----------788774--66789999999999889", - scores.get(2)); - AssertJUnit.assertEquals( - "99999999999999999999999999986-------4321----1-35----------78777--356789999999999889", - scores.get(3)); - AssertJUnit.assertEquals( - "999999999999999999999999999861-------3------1135----------78877--356789999999997-67", - scores.get(4)); - AssertJUnit.assertEquals( - "99999999999999999999999999986-------422-------34----------687774--56779999999999889", - scores.get(5)); - AssertJUnit.assertEquals( - "99999999999999999999999999985-------32--------35----------6888842356789999999999889", - scores.get(6)); - AssertJUnit.assertEquals( - "99999999999999999999999999974-------2---------24----------6878742356789999999999889", - scores.get(7)); - AssertJUnit.assertEquals( - "99999999999999999999999999985100011032110000113400100000006877641356789999999999889", - scores.get(8)); + AssertJUnit + .assertEquals( + "999999999999999999999999998762112222543211112134----------5666642367889999999999889", + scores.get(0)); + AssertJUnit + .assertEquals( + "99999999999999999999999999987-------4322----22341111111111676653-355679999999999889", + scores.get(1)); + AssertJUnit + .assertEquals( + "99999999999999999999999999987-------5321----2246----------788774--66789999999999889", + scores.get(2)); + AssertJUnit + .assertEquals( + "99999999999999999999999999986-------4321----1-35----------78777--356789999999999889", + scores.get(3)); + AssertJUnit + .assertEquals( + "999999999999999999999999999861-------3------1135----------78877--356789999999997-67", + scores.get(4)); + AssertJUnit + .assertEquals( + "99999999999999999999999999986-------422-------34----------687774--56779999999999889", + scores.get(5)); + AssertJUnit + .assertEquals( + "99999999999999999999999999985-------32--------35----------6888842356789999999999889", + scores.get(6)); + AssertJUnit + .assertEquals( + "99999999999999999999999999974-------2---------24----------6878742356789999999999889", + scores.get(7)); + AssertJUnit + .assertEquals( + "99999999999999999999999999985100011032110000113400100000006877641356789999999999889", + scores.get(8)); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetAsArray() throws IOException { @@ -234,7 +263,7 @@ public class TCoffeeScoreFileTest } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testHeightAndWidthWithResidueNumbers() throws Exception { String file = "test/jalview/io/tcoffee.score_ascii_with_residue_numbers"; diff --git a/test/jalview/schemes/DnaCodonTests.java b/test/jalview/schemes/DnaCodonTests.java index 3d20190..ff2f2aa 100644 --- a/test/jalview/schemes/DnaCodonTests.java +++ b/test/jalview/schemes/DnaCodonTests.java @@ -29,13 +29,13 @@ import org.testng.annotations.Test; public class DnaCodonTests { - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testAmbiguityCodeGeneration() { assertTrue(ResidueProperties.ambiguityCodes.size() > 0); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testAmbiguityCodon() { for (String ac : ResidueProperties.ambiguityCodes.keySet()) @@ -45,7 +45,7 @@ public class DnaCodonTests } } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void regenerateCodonTable() { for (Map.Entry codon : ResidueProperties.codonHash2 @@ -56,7 +56,7 @@ public class DnaCodonTests } } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void checkOldCodonagainstNewCodonTable() { // note - this test will be removed once the old codon table (including diff --git a/test/jalview/schemes/ResiduePropertiesTest.java b/test/jalview/schemes/ResiduePropertiesTest.java index b1d860e..479644c 100644 --- a/test/jalview/schemes/ResiduePropertiesTest.java +++ b/test/jalview/schemes/ResiduePropertiesTest.java @@ -14,7 +14,7 @@ public class ResiduePropertiesTest /** * Test 'standard' codon translations (no ambiguity codes) */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testCodonTranslate() { // standard translation table order column 1/2/3/4 @@ -88,7 +88,7 @@ public class ResiduePropertiesTest * Test a sample of codon translations involving ambiguity codes. Should * return a protein value where the ambiguity does not affect the translation. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testCodonTranslate_ambiguityCodes() { // Y is C or T @@ -175,7 +175,7 @@ public class ResiduePropertiesTest assertNull(ResidueProperties.codonTranslate("WSK")); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetResidues_nucleotide() { /* @@ -194,7 +194,7 @@ public class ResiduePropertiesTest assertEquals("[A, C, G, I, N, R, T, U, X, Y]", residues.toString()); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetResidues_peptide() { /* diff --git a/test/jalview/schemes/ScoreMatrixPrinter.java b/test/jalview/schemes/ScoreMatrixPrinter.java index f00ac8d..293690b 100644 --- a/test/jalview/schemes/ScoreMatrixPrinter.java +++ b/test/jalview/schemes/ScoreMatrixPrinter.java @@ -28,7 +28,7 @@ import org.testng.annotations.Test; public class ScoreMatrixPrinter { - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void printAllMatrices() { for (Map.Entry sm : ResidueProperties.scoreMatrices @@ -39,7 +39,7 @@ public class ScoreMatrixPrinter } } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void printHTMLMatrices() { for (Map.Entry _sm : ResidueProperties.scoreMatrices diff --git a/test/jalview/structure/Mapping.java b/test/jalview/structure/Mapping.java index c057980..aae1f3d 100644 --- a/test/jalview/structure/Mapping.java +++ b/test/jalview/structure/Mapping.java @@ -27,8 +27,7 @@ public class Mapping * 115 in PDB Res Numbering secondary structure numbers in jmol seem to be in * msd numbering, not pdb res numbering. */ - @Test(groups = - { "Functional" }, enabled = false) + @Test(groups = { "Functional" }, enabled = false) public void pdbEntryPositionMap() throws Exception { Assert.fail("This test intentionally left to fail"); @@ -44,15 +43,12 @@ public class Mapping // original numbers taken from // http://www.ebi.ac.uk/pdbe-srv/view/entry/1qcf/secondary.html // these are in numbering relative to the subsequence above - int coils[] = - { 266, 275, 278, 287, 289, 298, 302, 316 }, helices[] = new int[] - { 303, 315 }, sheets[] = new int[] - { 267, 268, 269, 270 }; + int coils[] = { 266, 275, 278, 287, 289, 298, 302, 316 }, helices[] = new int[] + { 303, 315 }, sheets[] = new int[] { 267, 268, 269, 270 }; StructureSelectionManager ssm = new jalview.structure.StructureSelectionManager(); - PDBfile pmap = ssm.setMapping(true, new SequenceI[] - { uprot }, new String[] - { "A" }, "test/jalview/ext/jmol/1QCF.pdb", + PDBfile pmap = ssm.setMapping(true, new SequenceI[] { uprot }, + new String[] { "A" }, "test/jalview/ext/jmol/1QCF.pdb", jalview.io.FormatAdapter.FILE); assertTrue(pmap != null); SequenceI protseq = pmap.getSeqsAsArray()[0]; @@ -110,8 +106,7 @@ public class Mapping } } - @Test(groups = - { "Functional" }, enabled = false) + @Test(groups = { "Functional" }, enabled = false) public void testPDBentryMapping() throws Exception { Assert.fail("This test intentionally left to fail"); @@ -123,8 +118,7 @@ public class Mapping StructureSelectionManager ssm = new jalview.structure.StructureSelectionManager(); // Associate the 1GAQ pdb file with the subsequence 'imported' from another // source - PDBfile pde = ssm.setMapping(true, new SequenceI[] - { sq }, new String[] + PDBfile pde = ssm.setMapping(true, new SequenceI[] { sq }, new String[] { "A" }, inFile = "examples/1gaq.txt", jalview.io.FormatAdapter.FILE); assertTrue("PDB File couldn't be found", pde != null); StructureMapping[] mp = ssm.getMapping(inFile); @@ -196,8 +190,7 @@ public class Mapping Annotation a = transfer.annotations[tanpos], b = alan.annotations[p]; assertEquals("Non-equivalent annotation element at " + p + "(" + rseqpos + ")" + " expected at " + fpos + " (alIndex " - + tanpos + ")", - a == null ? a : a.toString(), + + tanpos + ")", a == null ? a : a.toString(), b == null ? b : b.toString()); System.out.print("(" + a + "|" + b + ")"); } @@ -212,7 +205,7 @@ public class Mapping * transform * */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void mapFer1From3W5V() throws Exception { AlignFrame seqf = new FileLoader(false) @@ -221,9 +214,8 @@ public class Mapping FormatAdapter.PASTE, "FASTA"); SequenceI newseq = seqf.getViewport().getAlignment().getSequenceAt(0); StructureSelectionManager ssm = new jalview.structure.StructureSelectionManager(); - PDBfile pmap = ssm.setMapping(true, new SequenceI[] - { newseq }, new String[] - { null }, "examples/3W5V.pdb", + PDBfile pmap = ssm.setMapping(true, new SequenceI[] { newseq }, + new String[] { null }, "examples/3W5V.pdb", jalview.io.FormatAdapter.FILE); if (pmap == null) { @@ -235,7 +227,7 @@ public class Mapping * compare reference annotation for imported pdb sequence to identical * seuqence with transferred annotation from mapped pdb file */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void compareTransferredToRefPDBAnnot() throws Exception { AlignFrame ref = new FileLoader(false) @@ -250,9 +242,8 @@ public class Mapping StructureSelectionManager ssm = new jalview.structure.StructureSelectionManager(); ssm.setProcessSecondaryStructure(true); ssm.setAddTempFacAnnot(true); - PDBfile pmap = ssm.setMapping(true, new SequenceI[] - { newseq }, new String[] - { null }, "test/jalview/ext/jmol/1QCF.pdb", + PDBfile pmap = ssm.setMapping(true, new SequenceI[] { newseq }, + new String[] { null }, "test/jalview/ext/jmol/1QCF.pdb", jalview.io.FormatAdapter.FILE); assertTrue(pmap != null); assertEquals("Original and copied sequence of different lengths.", diff --git a/test/jalview/structure/StructureSelectionManagerTest.java b/test/jalview/structure/StructureSelectionManagerTest.java index 8e3e086..44a19f3 100644 --- a/test/jalview/structure/StructureSelectionManagerTest.java +++ b/test/jalview/structure/StructureSelectionManagerTest.java @@ -21,13 +21,13 @@ public class StructureSelectionManagerTest { private StructureSelectionManager ssm; - @BeforeMethod(alwaysRun = true) + @BeforeMethod(alwaysRun = true) public void setUp() { ssm = new StructureSelectionManager(); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testRegisterMapping() { AlignedCodonFrame acf1 = new AlignedCodonFrame(); @@ -51,7 +51,7 @@ public class StructureSelectionManagerTest assertTrue(ssm.seqmappings.contains(acf2)); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testRegisterMappings() { AlignedCodonFrame acf1 = new AlignedCodonFrame(); @@ -93,8 +93,7 @@ public class StructureSelectionManagerTest sm.setProcessSecondaryStructure(true); sm.setAddTempFacAnnot(true); PDBfile pmap = sm.setMapping(true, new SequenceI[] { seq }, - new String[] { null }, "examples/1gaq.txt", - FormatAdapter.FILE); + new String[] { null }, "examples/1gaq.txt", FormatAdapter.FILE); assertTrue(pmap != null); assertEquals(3, pmap.getSeqs().size()); diff --git a/test/jalview/structures/models/AAStructureBindingModelTest.java b/test/jalview/structures/models/AAStructureBindingModelTest.java index 1466760..b8f7874 100644 --- a/test/jalview/structures/models/AAStructureBindingModelTest.java +++ b/test/jalview/structures/models/AAStructureBindingModelTest.java @@ -57,14 +57,13 @@ public class AAStructureBindingModelTest /** * Set up test conditions with three aligned sequences, */ - @BeforeMethod(alwaysRun = true) + @BeforeMethod(alwaysRun = true) public void setUp() { SequenceI seq1 = new Sequence("1YCS", "-VPSQK"); SequenceI seq2 = new Sequence("3A6S", "MK-KLQ"); SequenceI seq3 = new Sequence("1OOT", "SPK-AV"); - al = new Alignment(new SequenceI[] - { seq1, seq2, seq3 }); + al = new Alignment(new SequenceI[] { seq1, seq2, seq3 }); al.setDataset(null); PDBEntry[] pdbFiles = new PDBEntry[3]; @@ -73,20 +72,17 @@ public class AAStructureBindingModelTest pdbFiles[2] = new PDBEntry("1OOT", "A", Type.PDB, "1OOT.pdb"); String[][] chains = new String[3][]; SequenceI[][] seqs = new SequenceI[3][]; - seqs[0] = new SequenceI[] - { seq1 }; - seqs[1] = new SequenceI[] - { seq2 }; - seqs[2] = new SequenceI[] - { seq3 }; + seqs[0] = new SequenceI[] { seq1 }; + seqs[1] = new SequenceI[] { seq2 }; + seqs[2] = new SequenceI[] { seq3 }; StructureSelectionManager ssm = new StructureSelectionManager(); - ssm.setMapping(new SequenceI[] - { seq1 }, null, PDB_1, AppletFormatAdapter.PASTE); - ssm.setMapping(new SequenceI[] - { seq2 }, null, PDB_2, AppletFormatAdapter.PASTE); - ssm.setMapping(new SequenceI[] - { seq3 }, null, PDB_3, AppletFormatAdapter.PASTE); + ssm.setMapping(new SequenceI[] { seq1 }, null, PDB_1, + AppletFormatAdapter.PASTE); + ssm.setMapping(new SequenceI[] { seq2 }, null, PDB_2, + AppletFormatAdapter.PASTE); + ssm.setMapping(new SequenceI[] { seq3 }, null, PDB_3, + AppletFormatAdapter.PASTE); testee = new AAStructureBindingModel(ssm, pdbFiles, seqs, chains, null) { @@ -97,17 +93,19 @@ public class AAStructureBindingModelTest * fudge 'filenames' to match those generated when PDBFile parses PASTE * data */ - return new String[] - { "INLINE1YCS", "INLINE3A6S", "INLINE1OOT" }; + return new String[] { "INLINE1YCS", "INLINE3A6S", "INLINE1OOT" }; } + @Override public void updateColours(Object source) { } + @Override public void releaseReferences(Object svl) { } + @Override public void highlightAtoms(List atoms) { @@ -119,7 +117,7 @@ public class AAStructureBindingModelTest * Verify that the method determines that columns 2, 5 and 6 of the alignment * are alignable in structure */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testFindSuperposableResidues() { SuperposeData[] structs = new SuperposeData[al.getHeight()]; @@ -150,7 +148,7 @@ public class AAStructureBindingModelTest assertTrue(matched[5]); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testFindSuperposableResidues_hiddenColumn() { SuperposeData[] structs = new SuperposeData[al.getHeight()]; diff --git a/test/jalview/util/ColorUtilsTest.java b/test/jalview/util/ColorUtilsTest.java index 6d8dded..0e8c6f7 100644 --- a/test/jalview/util/ColorUtilsTest.java +++ b/test/jalview/util/ColorUtilsTest.java @@ -16,7 +16,7 @@ public class ColorUtilsTest Color darkColour = new Color(11, 30, 50); // dark blue - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testDarkerThan() { assertEquals("Wrong darker shade", new Color(32, 69, 37), @@ -28,7 +28,7 @@ public class ColorUtilsTest assertNull(ColorUtils.darkerThan(null)); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testBrighterThan() { assertEquals("Wrong brighter shade", new Color(255, 255, 255), // white @@ -43,7 +43,7 @@ public class ColorUtilsTest /** * @see http://www.rtapo.com/notes/named_colors.html */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testToTkCode() { assertEquals("#fffafa", ColorUtils.toTkCode(new Color(255, 250, 250))); // snow diff --git a/test/jalview/util/ComparisonTest.java b/test/jalview/util/ComparisonTest.java index d8efa69..51b1fa2 100644 --- a/test/jalview/util/ComparisonTest.java +++ b/test/jalview/util/ComparisonTest.java @@ -12,7 +12,7 @@ import org.testng.annotations.Test; public class ComparisonTest { - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testIsGap() { assertTrue(Comparison.isGap('-')); @@ -28,64 +28,53 @@ public class ComparisonTest * Test for isNucleotide is that sequences in a dataset are more than 85% * AGCTU. Test is not case-sensitive and ignores gaps. */ - @Test(groups ={ "Functional" }) - public void testIsNucleotide() { + @Test(groups = { "Functional" }) + public void testIsNucleotide() + { SequenceI seq = new Sequence("eightypercent", "agctuAGCPV"); - assertFalse(Comparison.isNucleotide(new SequenceI[] - { seq })); - assertFalse(Comparison.isNucleotide(new SequenceI[][] - { new SequenceI[] + assertFalse(Comparison.isNucleotide(new SequenceI[] { seq })); + assertFalse(Comparison.isNucleotide(new SequenceI[][] { new SequenceI[] { seq } })); seq = new Sequence("eightyfivepercent", "agctuAGCPVagctuAGCUV"); - assertFalse(Comparison.isNucleotide(new SequenceI[] - { seq })); + assertFalse(Comparison.isNucleotide(new SequenceI[] { seq })); seq = new Sequence("nineypercent", "agctuAGCgVagctuAGCUV"); - assertTrue(Comparison.isNucleotide(new SequenceI[] - { seq })); + assertTrue(Comparison.isNucleotide(new SequenceI[] { seq })); seq = new Sequence("eightyfivepercentgapped", "--agc--tuA--GCPV-a---gct-uA-GC---UV"); - assertFalse(Comparison.isNucleotide(new SequenceI[] - { seq })); + assertFalse(Comparison.isNucleotide(new SequenceI[] { seq })); seq = new Sequence("nineypercentgapped", "ag--ct-u-A---GC---g----Vag--c---tuAGCUV"); - assertTrue(Comparison.isNucleotide(new SequenceI[] - { seq })); + assertTrue(Comparison.isNucleotide(new SequenceI[] { seq })); seq = new Sequence("allgap", "---------"); - assertFalse(Comparison.isNucleotide(new SequenceI[] - { seq })); + assertFalse(Comparison.isNucleotide(new SequenceI[] { seq })); seq = new Sequence("DNA", "ACTugGCCAG"); SequenceI seq2 = new Sequence("Protein", "FLIMVSPTYW"); /* * 90% DNA: */ - assertTrue(Comparison.isNucleotide(new SequenceI[] - { seq, seq, seq, seq, seq, seq, seq, seq, seq, seq2 })); - assertTrue(Comparison.isNucleotide(new SequenceI[][] - { new SequenceI[] - { seq }, new SequenceI[] - { seq, seq, seq }, new SequenceI[] - { seq, seq, seq, seq, seq, seq2 } })); + assertTrue(Comparison.isNucleotide(new SequenceI[] { seq, seq, seq, + seq, seq, seq, seq, seq, seq, seq2 })); + assertTrue(Comparison.isNucleotide(new SequenceI[][] { + new SequenceI[] { seq }, new SequenceI[] { seq, seq, seq }, + new SequenceI[] { seq, seq, seq, seq, seq, seq2 } })); /* * 80% DNA: */ - assertFalse(Comparison.isNucleotide(new SequenceI[] - { seq, seq, seq, seq, seq, seq, seq, seq, seq2, seq2 })); - assertFalse(Comparison.isNucleotide(new SequenceI[][] - { new SequenceI[] - { seq }, new SequenceI[] - { seq, seq, seq }, new SequenceI[] - { seq, seq, seq, seq, seq2, seq2, null } })); + assertFalse(Comparison.isNucleotide(new SequenceI[] { seq, seq, seq, + seq, seq, seq, seq, seq, seq2, seq2 })); + assertFalse(Comparison.isNucleotide(new SequenceI[][] { new SequenceI[] + { seq }, new SequenceI[] { seq, seq, seq }, + new SequenceI[] { seq, seq, seq, seq, seq2, seq2, null } })); seq = new Sequence("ProteinThatLooksLikeDNA", "WYATGCCTGAgtcgt"); // 12/14 = 85.7% - assertTrue(Comparison.isNucleotide(new SequenceI[] - { seq })); + assertTrue(Comparison.isNucleotide(new SequenceI[] { seq })); assertFalse(Comparison.isNucleotide((SequenceI[]) null)); assertFalse(Comparison.isNucleotide((SequenceI[][]) null)); @@ -94,7 +83,7 @@ public class ComparisonTest /** * Test percentage identity calculation for two sequences. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testPID_matchGaps() { String seq1 = "ABCDEF"; 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]); diff --git a/test/jalview/util/MapListTest.java b/test/jalview/util/MapListTest.java index 6e7e19e..0f50e61 100644 --- a/test/jalview/util/MapListTest.java +++ b/test/jalview/util/MapListTest.java @@ -14,27 +14,22 @@ import org.testng.annotations.Test; public class MapListTest { - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testSomething() { - MapList ml = new MapList(new int[] - { 1, 5, 10, 15, 25, 20 }, new int[] - { 51, 1 }, 1, 3); - MapList ml1 = new MapList(new int[] - { 1, 3, 17, 4 }, new int[] - { 51, 1 }, 1, 3); - MapList ml2 = new MapList(new int[] - { 1, 60 }, new int[] - { 1, 20 }, 3, 1); + MapList ml = new MapList(new int[] { 1, 5, 10, 15, 25, 20 }, new int[] { + 51, 1 }, 1, 3); + MapList ml1 = new MapList(new int[] { 1, 3, 17, 4 }, + new int[] { 51, 1 }, 1, 3); + MapList ml2 = new MapList(new int[] { 1, 60 }, new int[] { 1, 20 }, 3, + 1); // test internal consistency int to[] = new int[51]; testMap(ml, 1, 60); - MapList mldna = new MapList(new int[] - { 2, 2, 6, 8, 12, 16 }, new int[] + MapList mldna = new MapList(new int[] { 2, 2, 6, 8, 12, 16 }, new int[] { 1, 3 }, 3, 1); int[] frm = mldna.locateInFrom(1, 1); - testLocateFrom(mldna, 1, 1, new int[] - { 2, 2, 6, 7 }); + testLocateFrom(mldna, 1, 1, new int[] { 2, 2, 6, 7 }); testMap(mldna, 1, 3); /* * for (int from=1; from<=51; from++) { int[] too=ml.shiftTo(from); int[] @@ -99,7 +94,7 @@ public class MapListTest if (mmap[1][i - 1] == -1) { System.out.print(i + "=XXX"); - + } else { @@ -160,7 +155,7 @@ public class MapListTest if (mmap[1][i - 1] == -1) { System.out.print(i + "=XXX"); - + } else { @@ -219,16 +214,14 @@ public class MapListTest * Tests for method that locates ranges in the 'from' map for given range in * the 'to' map. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testLocateInFrom_noIntrons() { /* * Simple mapping with no introns */ - int[] codons = new int[] - { 1, 12 }; - int[] protein = new int[] - { 1, 4 }; + int[] codons = new int[] { 1, 12 }; + int[] protein = new int[] { 1, 4 }; MapList ml = new MapList(codons, protein, 3, 1); assertEquals("[1, 3]", Arrays.toString(ml.locateInFrom(1, 1))); assertEquals("[4, 6]", Arrays.toString(ml.locateInFrom(2, 2))); @@ -251,17 +244,15 @@ public class MapListTest * Tests for method that locates ranges in the 'from' map for given range in * the 'to' map. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testLocateInFrom_withIntrons() { /* * Exons at positions [2, 3, 5] [6, 7, 9] [10, 12, 14] [16, 17, 18] i.e. * 2-3, 5-7, 9-10, 12-12, 14-14, 16-18 */ - int[] codons = - { 2, 3, 5, 7, 9, 10, 12, 12, 14, 14, 16, 18 }; - int[] protein = - { 1, 4 }; + int[] codons = { 2, 3, 5, 7, 9, 10, 12, 12, 14, 14, 16, 18 }; + int[] protein = { 1, 4 }; MapList ml = new MapList(codons, protein, 3, 1); assertEquals("[2, 3, 5, 5]", Arrays.toString(ml.locateInFrom(1, 1))); assertEquals("[6, 7, 9, 9]", Arrays.toString(ml.locateInFrom(2, 2))); @@ -274,16 +265,14 @@ public class MapListTest * Tests for method that locates ranges in the 'to' map for given range in the * 'from' map. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testLocateInTo_noIntrons() { /* * Simple mapping with no introns */ - int[] codons = new int[] - { 1, 12 }; - int[] protein = new int[] - { 1, 4 }; + int[] codons = new int[] { 1, 12 }; + int[] protein = new int[] { 1, 4 }; MapList ml = new MapList(codons, protein, 3, 1); assertEquals("[1, 1]", Arrays.toString(ml.locateInTo(1, 3))); assertEquals("[2, 2]", Arrays.toString(ml.locateInTo(4, 6))); @@ -314,20 +303,18 @@ public class MapListTest * Tests for method that locates ranges in the 'to' map for given range in the * 'from' map. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testLocateInTo_withIntrons() { /* * Exons at positions [2, 3, 5] [6, 7, 9] [10, 12, 14] [16, 17, 18] i.e. * 2-3, 5-7, 9-10, 12-12, 14-14, 16-18 */ - int[] codons = - { 2, 3, 5, 7, 9, 10, 12, 12, 14, 14, 16, 18 }; + int[] codons = { 2, 3, 5, 7, 9, 10, 12, 12, 14, 14, 16, 18 }; /* * Mapped proteins at positions 1, 3, 4, 6 in the sequence */ - int[] protein = - { 1, 1, 3, 4, 6, 6 }; + int[] protein = { 1, 1, 3, 4, 6, 6 }; MapList ml = new MapList(codons, protein, 3, 1); /* @@ -357,13 +344,11 @@ public class MapListTest /** * Test equals method. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testEquals() { - int[] codons = new int[] - { 2, 3, 5, 7, 9, 10, 12, 12, 14, 14, 16, 18 }; - int[] protein = new int[] - { 1, 4 }; + int[] codons = new int[] { 2, 3, 5, 7, 9, 10, 12, 12, 14, 14, 16, 18 }; + int[] protein = new int[] { 1, 4 }; MapList ml = new MapList(codons, protein, 3, 1); MapList ml1 = new MapList(codons, protein, 3, 1); // same values MapList ml2 = new MapList(codons, protein, 2, 1); // fromRatio differs @@ -406,27 +391,23 @@ public class MapListTest /** * Test for the method that flattens a list of ranges into a single array. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetRanges() { List ranges = new ArrayList(); - ranges.add(new int[] - { 2, 3 }); - ranges.add(new int[] - { 5, 6 }); + ranges.add(new int[] { 2, 3 }); + ranges.add(new int[] { 5, 6 }); assertEquals("[2, 3, 5, 6]", Arrays.toString(MapList.getRanges(ranges))); } /** * Check state after construction */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testConstructor() { - int[] codons = - { 2, 3, 5, 7, 9, 10, 12, 12, 14, 14, 16, 18 }; - int[] protein = - { 1, 1, 3, 4, 6, 6 }; + int[] codons = { 2, 3, 5, 7, 9, 10, 12, 12, 14, 14, 16, 18 }; + int[] protein = { 1, 1, 3, 4, 6, 6 }; MapList ml = new MapList(codons, protein, 3, 1); assertEquals(3, ml.getFromRatio()); assertEquals(2, ml.getFromLowest()); @@ -478,13 +459,11 @@ public class MapListTest /** * Test the method that creates an inverse mapping */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetInverse() { - int[] codons = - { 2, 3, 5, 7, 9, 10, 12, 12, 14, 14, 16, 18 }; - int[] protein = - { 1, 1, 3, 4, 6, 6 }; + int[] codons = { 2, 3, 5, 7, 9, 10, 12, 12, 14, 14, 16, 18 }; + int[] protein = { 1, 1, 3, 4, 6, 6 }; MapList ml = new MapList(codons, protein, 3, 1); MapList ml2 = ml.getInverse(); @@ -498,12 +477,11 @@ public class MapListTest prettyPrint(ml2.getFromRanges())); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testToString() { - MapList ml = new MapList(new int[] - { 1, 5, 10, 15, 25, 20 }, new int[] - { 51, 1 }, 1, 3); + MapList ml = new MapList(new int[] { 1, 5, 10, 15, 25, 20 }, new int[] { + 51, 1 }, 1, 3); String s = ml.toString(); assertEquals("From (1:3) [ [1, 5] [10, 15] [25, 20] ] To [ [51, 1] ]", s); diff --git a/test/jalview/util/MappingUtilsTest.java b/test/jalview/util/MappingUtilsTest.java index 2c0045b..25ca1b4 100644 --- a/test/jalview/util/MappingUtilsTest.java +++ b/test/jalview/util/MappingUtilsTest.java @@ -1,6 +1,5 @@ package jalview.util; - import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertSame; import static org.testng.AssertJUnit.assertTrue; @@ -31,12 +30,13 @@ import org.testng.annotations.Test; public class MappingUtilsTest { private AlignViewportI dnaView; + private AlignViewportI proteinView; /** * Simple test of mapping with no intron involved. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testBuildSearchResults() { final Sequence seq1 = new Sequence("Seq1", "C-G-TA-GC"); @@ -49,9 +49,7 @@ public class MappingUtilsTest * Map dna bases 1-6 to protein residues 1-2 */ AlignedCodonFrame acf = new AlignedCodonFrame(); - MapList map = new MapList(new int[] - { 1, 6 }, new int[] - { 1, 2 }, 3, 1); + MapList map = new MapList(new int[] { 1, 6 }, new int[] { 1, 2 }, 3, 1); acf.addMap(seq1.getDatasetSequence(), aseq1.getDatasetSequence(), map); Set acfList = Collections.singleton(acf); @@ -89,25 +87,24 @@ public class MappingUtilsTest /** * Simple test of mapping with introns involved. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testBuildSearchResults_withIntron() { final Sequence seq1 = new Sequence("Seq1", "C-G-TAGA-GCAGCTT"); seq1.createDatasetSequence(); - + final Sequence aseq1 = new Sequence("Seq1", "-P-R"); aseq1.createDatasetSequence(); - + /* * Map dna bases [2, 4, 5], [7, 9, 11] to protein residues 1 and 2 */ AlignedCodonFrame acf = new AlignedCodonFrame(); - MapList map = new MapList(new int[] - { 2, 2, 4, 5, 7, 7, 9, 9, 11, 11 }, new int[] - { 1, 2 }, 3, 1); + MapList map = new MapList(new int[] { 2, 2, 4, 5, 7, 7, 9, 9, 11, 11 }, + new int[] { 1, 2 }, 3, 1); acf.addMap(seq1.getDatasetSequence(), aseq1.getDatasetSequence(), map); Set acfList = Collections.singleton(acf); - + /* * Check protein residue 1 maps to [2, 4, 5] */ @@ -139,7 +136,7 @@ public class MappingUtilsTest assertEquals(seq1.getDatasetSequence(), m.getSequence()); assertEquals(11, m.getStart()); assertEquals(11, m.getEnd()); - + /* * Check inverse mappings, from codons to protein */ @@ -166,7 +163,7 @@ public class MappingUtilsTest * * @throws IOException */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testMapSequenceGroup_sequences() throws IOException { /* @@ -180,9 +177,7 @@ public class MappingUtilsTest "FASTA"); protein.setDataset(null); AlignedCodonFrame acf = new AlignedCodonFrame(); - MapList map = new MapList(new int[] - { 1, 3 }, new int[] - { 1, 1 }, 3, 1); + MapList map = new MapList(new int[] { 1, 3 }, new int[] { 1, 1 }, 3, 1); for (int seq = 0; seq < 3; seq++) { acf.addMap(cdna.getSequenceAt(seq).getDatasetSequence(), protein @@ -207,7 +202,8 @@ public class MappingUtilsTest /* * Verify the mapped sequence group in dna */ - SequenceGroup mappedGroup = MappingUtils.mapSequenceGroup(sg, proteinView, dnaView); + SequenceGroup mappedGroup = MappingUtils.mapSequenceGroup(sg, + proteinView, dnaView); assertTrue(mappedGroup.getColourText()); assertSame(sg.getIdColour(), mappedGroup.getIdColour()); assertSame(sg.getOutlineColour(), mappedGroup.getOutlineColour()); @@ -259,11 +255,11 @@ public class MappingUtilsTest * * @throws IOException */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testMapColumnSelection_proteinToDna() throws IOException { setupMappedAlignments(); - + ColumnSelection colsel = new ColumnSelection(); /* @@ -322,31 +318,26 @@ public class MappingUtilsTest * viewport). Lower case for introns. */ AlignmentI cdna = loadAlignment(">Seq1\nAC-GctGtC-T\n" - + ">Seq2\nTc-GA-G-T-Tc\n" + ">Seq3\nTtTT-AaCGg-\n", - "FASTA"); + + ">Seq2\nTc-GA-G-T-Tc\n" + ">Seq3\nTtTT-AaCGg-\n", "FASTA"); cdna.setDataset(null); AlignmentI protein = loadAlignment( - ">Seq1\n-K-P\n>Seq2\nL--Q\n>Seq3\nG--S\n", - "FASTA"); + ">Seq1\n-K-P\n>Seq2\nL--Q\n>Seq3\nG--S\n", "FASTA"); protein.setDataset(null); AlignedCodonFrame acf = new AlignedCodonFrame(); - MapList map = new MapList(new int[] - { 1, 3, 6, 6, 8, 9 }, new int[] - { 1, 2 }, 3, 1); + MapList map = new MapList(new int[] { 1, 3, 6, 6, 8, 9 }, new int[] { + 1, 2 }, 3, 1); acf.addMap(cdna.getSequenceAt(0).getDatasetSequence(), protein .getSequenceAt(0).getDatasetSequence(), map); - map = new MapList(new int[] - { 1, 1, 3, 4, 5, 7 }, new int[] - { 1, 2 }, 3, 1); + map = new MapList(new int[] { 1, 1, 3, 4, 5, 7 }, new int[] { 1, 2 }, + 3, 1); acf.addMap(cdna.getSequenceAt(1).getDatasetSequence(), protein .getSequenceAt(1).getDatasetSequence(), map); - map = new MapList(new int[] - { 1, 1, 3, 4, 5, 5, 7, 8 }, new int[] - { 1, 2 }, 3, 1); + map = new MapList(new int[] { 1, 1, 3, 4, 5, 5, 7, 8 }, new int[] { 1, + 2 }, 3, 1); acf.addMap(cdna.getSequenceAt(2).getDatasetSequence(), protein .getSequenceAt(2).getDatasetSequence(), map); Set acfList = Collections.singleton(acf); - + dnaView = new AlignViewport(cdna); proteinView = new AlignViewport(protein); protein.setCodonFrames(acfList); @@ -357,13 +348,13 @@ public class MappingUtilsTest * * @throws IOException */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testMapColumnSelection_dnaToProtein() throws IOException { setupMappedAlignments(); - + ColumnSelection colsel = new ColumnSelection(); - + /* * Column 0 in dna picks up first bases which map to residue 1, columns 0-1 * in protein. @@ -384,7 +375,7 @@ public class MappingUtilsTest assertEquals("[0, 1, 3]", cs.getSelected().toString()); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testMapColumnSelection_null() throws IOException { setupMappedAlignments(); @@ -397,25 +388,28 @@ public class MappingUtilsTest * Tests for the method that converts a series of [start, end] ranges to * single positions */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testFlattenRanges() { assertEquals("[1, 2, 3, 4]", - Arrays.toString(MappingUtils.flattenRanges(new int[] - { 1, 4 }))); - assertEquals("[1, 2, 3, 4]", - Arrays.toString(MappingUtils.flattenRanges(new int[] - { 1, 2, 3, 4 }))); - assertEquals("[1, 2, 3, 4]", - Arrays.toString(MappingUtils.flattenRanges(new int[] - { 1, 1, 2, 2, 3, 3, 4, 4 }))); - assertEquals("[1, 2, 3, 4, 7, 8, 9, 12]", - Arrays.toString(MappingUtils.flattenRanges(new int[] - { 1, 4, 7, 9, 12, 12 }))); + Arrays.toString(MappingUtils.flattenRanges(new int[] { 1, 4 }))); + assertEquals( + "[1, 2, 3, 4]", + Arrays.toString(MappingUtils.flattenRanges(new int[] { 1, 2, 3, + 4 }))); + assertEquals( + "[1, 2, 3, 4]", + Arrays.toString(MappingUtils.flattenRanges(new int[] { 1, 1, 2, + 2, 3, 3, 4, 4 }))); + assertEquals( + "[1, 2, 3, 4, 7, 8, 9, 12]", + Arrays.toString(MappingUtils.flattenRanges(new int[] { 1, 4, 7, + 9, 12, 12 }))); // unpaired start position is ignored: - assertEquals("[1, 2, 3, 4, 7, 8, 9, 12]", - Arrays.toString(MappingUtils.flattenRanges(new int[] - { 1, 4, 7, 9, 12, 12, 15 }))); + assertEquals( + "[1, 2, 3, 4, 7, 8, 9, 12]", + Arrays.toString(MappingUtils.flattenRanges(new int[] { 1, 4, 7, + 9, 12, 12, 15 }))); } /** @@ -423,7 +417,7 @@ public class MappingUtilsTest * * @throws IOException */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testMapSequenceGroup_columns() throws IOException { /* @@ -431,27 +425,24 @@ public class MappingUtilsTest * viewport). */ AlignmentI cdna = loadAlignment( - ">Seq1\nACGGCA\n>Seq2\nTGACAG\n>Seq3\nTACGTA\n", - "FASTA"); + ">Seq1\nACGGCA\n>Seq2\nTGACAG\n>Seq3\nTACGTA\n", "FASTA"); cdna.setDataset(null); AlignmentI protein = loadAlignment(">Seq1\nKA\n>Seq2\nLQ\n>Seq3\nQV\n", "FASTA"); protein.setDataset(null); AlignedCodonFrame acf = new AlignedCodonFrame(); - MapList map = new MapList(new int[] - { 1, 6 }, new int[] - { 1, 2 }, 3, 1); + MapList map = new MapList(new int[] { 1, 6 }, new int[] { 1, 2 }, 3, 1); for (int seq = 0; seq < 3; seq++) { acf.addMap(cdna.getSequenceAt(seq).getDatasetSequence(), protein .getSequenceAt(seq).getDatasetSequence(), map); } Set acfList = Collections.singleton(acf); - + AlignViewportI dnaView = new AlignViewport(cdna); AlignViewportI proteinView = new AlignViewport(protein); protein.setCodonFrames(acfList); - + /* * Select all sequences, column 2 in the protein */ @@ -464,11 +455,12 @@ public class MappingUtilsTest sg.addSequence(protein.getSequenceAt(2), false); sg.setStartRes(1); sg.setEndRes(1); - + /* * Verify the mapped sequence group in dna */ - SequenceGroup mappedGroup = MappingUtils.mapSequenceGroup(sg, proteinView, dnaView); + SequenceGroup mappedGroup = MappingUtils.mapSequenceGroup(sg, + proteinView, dnaView); assertTrue(mappedGroup.getColourText()); assertSame(sg.getIdColour(), mappedGroup.getIdColour()); assertSame(sg.getOutlineColour(), mappedGroup.getOutlineColour()); @@ -478,7 +470,7 @@ public class MappingUtilsTest assertSame(cdna.getSequenceAt(2), mappedGroup.getSequences().get(2)); assertEquals(3, mappedGroup.getStartRes()); assertEquals(5, mappedGroup.getEndRes()); - + /* * Verify mapping sequence group from dna to protein */ @@ -506,7 +498,7 @@ public class MappingUtilsTest * * @throws IOException */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testMapSequenceGroup_region() throws IOException { /* @@ -521,20 +513,18 @@ public class MappingUtilsTest ">Seq1\n-KA-S\n>Seq2\n--L-QY\n>Seq3\nQ-V-M\n", "FASTA"); protein.setDataset(null); AlignedCodonFrame acf = new AlignedCodonFrame(); - MapList map = new MapList(new int[] - { 1, 9 }, new int[] - { 1, 3 }, 3, 1); + MapList map = new MapList(new int[] { 1, 9 }, new int[] { 1, 3 }, 3, 1); for (int seq = 0; seq < 3; seq++) { acf.addMap(cdna.getSequenceAt(seq).getDatasetSequence(), protein .getSequenceAt(seq).getDatasetSequence(), map); } Set acfList = Collections.singleton(acf); - + AlignViewportI dnaView = new AlignViewport(cdna); AlignViewportI proteinView = new AlignViewport(protein); protein.setCodonFrames(acfList); - + /* * Select Seq1 and Seq2 in the protein, column 1 (K/-). Expect mapped * sequence group to cover Seq1, columns 0-3 (ACG). Because the selection @@ -549,11 +539,12 @@ public class MappingUtilsTest sg.addSequence(protein.getSequenceAt(1), false); sg.setStartRes(1); sg.setEndRes(1); - + /* * Verify the mapped sequence group in dna */ - SequenceGroup mappedGroup = MappingUtils.mapSequenceGroup(sg, proteinView, dnaView); + SequenceGroup mappedGroup = MappingUtils.mapSequenceGroup(sg, + proteinView, dnaView); assertTrue(mappedGroup.getColourText()); assertSame(sg.getIdColour(), mappedGroup.getIdColour()); assertSame(sg.getOutlineColour(), mappedGroup.getOutlineColour()); @@ -563,7 +554,7 @@ public class MappingUtilsTest // Seq1 has K which should map to columns 0-3 in Seq1 assertEquals(0, mappedGroup.getStartRes()); assertEquals(3, mappedGroup.getEndRes()); - + /* * Now select cols 2-4 in protein. These cover Seq1:AS Seq2:LQ Seq3:VM which * extend over DNA columns 3-12, 1-7, 6-13 respectively, or 1-13 overall. @@ -600,7 +591,7 @@ public class MappingUtilsTest assertEquals(4, mappedGroup.getEndRes()); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testFindMappingsForSequence() { SequenceI seq1 = new Sequence("Seq1", "ABC"); @@ -616,20 +607,18 @@ public class MappingUtilsTest * Create mappings from seq1 to seq2, seq2 to seq1, seq3 to seq1 */ AlignedCodonFrame acf1 = new AlignedCodonFrame(); - MapList map = new MapList(new int[] - { 1, 3 }, new int[] - { 1, 3 },1, 1); + MapList map = new MapList(new int[] { 1, 3 }, new int[] { 1, 3 }, 1, 1); acf1.addMap(seq1.getDatasetSequence(), seq2.getDatasetSequence(), map); AlignedCodonFrame acf2 = new AlignedCodonFrame(); acf2.addMap(seq2.getDatasetSequence(), seq1.getDatasetSequence(), map); AlignedCodonFrame acf3 = new AlignedCodonFrame(); acf3.addMap(seq3.getDatasetSequence(), seq1.getDatasetSequence(), map); - + Set mappings = new HashSet(); mappings.add(acf1); mappings.add(acf2); mappings.add(acf3); - + /* * Seq1 has three mappings */ @@ -669,5 +658,5 @@ public class MappingUtilsTest result = MappingUtils.findMappingsForSequence(null, null); assertEquals(0, result.size()); -} + } } diff --git a/test/jalview/util/QuickSortTest.java b/test/jalview/util/QuickSortTest.java index ea55779..3e64249 100644 --- a/test/jalview/util/QuickSortTest.java +++ b/test/jalview/util/QuickSortTest.java @@ -20,87 +20,74 @@ public class QuickSortTest private Object[] things; - private final Object[] sortedThings = new Object[] - { c4, c2, c1, c3 }; + private final Object[] sortedThings = new Object[] { c4, c2, c1, c3 }; - @BeforeMethod(alwaysRun = true) + @BeforeMethod(alwaysRun = true) public void setUp() { - things = new Object[] - { c1, c2, c3, c4 }; + things = new Object[] { c1, c2, c3, c4 }; } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testSort_byIntValues() { - int[] values = new int[] - { 3, 2, 4, 1 }; + int[] values = new int[] { 3, 2, 4, 1 }; QuickSort.sort(values, things); - assertTrue(Arrays.equals(new int[] - { 1, 2, 3, 4 }, values)); + assertTrue(Arrays.equals(new int[] { 1, 2, 3, 4 }, values)); assertTrue(Arrays.equals(sortedThings, things)); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testSort_byFloatValues() { - float[] values = new float[] - { 3f, 2f, 4f, 1f }; + float[] values = new float[] { 3f, 2f, 4f, 1f }; QuickSort.sort(values, things); - assertTrue(Arrays.equals(new float[] - { 1f, 2f, 3f, 4f }, values)); + assertTrue(Arrays.equals(new float[] { 1f, 2f, 3f, 4f }, values)); assertTrue(Arrays.equals(sortedThings, things)); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testSort_byDoubleValues() { - double[] values = new double[] - { 3d, 2d, 4d, 1d }; + double[] values = new double[] { 3d, 2d, 4d, 1d }; QuickSort.sort(values, things); - assertTrue(Arrays.equals(new double[] - { 1d, 2d, 3d, 4d }, values)); + assertTrue(Arrays.equals(new double[] { 1d, 2d, 3d, 4d }, values)); assertTrue(Arrays.equals(sortedThings, things)); } /** * Sort by String is descending order, case-sensitive */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testSort_byStringValues() { - String[] values = new String[] - { "JOHN", "henry", "lucy", "ALISON" }; + String[] values = new String[] { "JOHN", "henry", "lucy", "ALISON" }; QuickSort.sort(values, things); - assertTrue(Arrays.equals(new String[] - { "lucy", "henry", "JOHN", "ALISON" }, values)); - assertTrue(Arrays.equals(new Object[] - { c3, c2, c1, c4 }, things)); + assertTrue(Arrays.equals(new String[] { "lucy", "henry", "JOHN", + "ALISON" }, values)); + assertTrue(Arrays.equals(new Object[] { c3, c2, c1, c4 }, things)); } /** * Test whether sort is stable i.e. equal values retain their mutual ordering. */ - @Test(groups = - { "Functional" }, enabled = false) + @Test(groups = { "Functional" }, enabled = false) public void testSort_withDuplicates() { - int[] values = new int[] - { 3, 4, 2, 4, 1 }; - Object [] things = new Object [] {"A", "X", "Y", "B", "Z"}; + int[] values = new int[] { 3, 4, 2, 4, 1 }; + Object[] things = new Object[] { "A", "X", "Y", "B", "Z" }; QuickSort.sort(values, things); - assertTrue(Arrays.equals(new int[] - { 1, 2, 3, 4, 4 }, values)); + assertTrue(Arrays.equals(new int[] { 1, 2, 3, 4, 4 }, values)); // this fails - do we care? - assertTrue(Arrays.equals(new Object[] - { "Z", "Y", "A", "X", "B" }, things)); + assertTrue(Arrays.equals(new Object[] { "Z", "Y", "A", "X", "B" }, + things)); } /** * Test that exercises sort with a mostly zero-valued sortby array. May be of * interest to check the sort algorithm is efficient. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testSort_MostlyZeroValues() { char[] residues = new char[64]; diff --git a/test/jalview/util/ShiftListTest.java b/test/jalview/util/ShiftListTest.java index eae2811..abe5534 100644 --- a/test/jalview/util/ShiftListTest.java +++ b/test/jalview/util/ShiftListTest.java @@ -11,18 +11,16 @@ import org.testng.annotations.Test; public class ShiftListTest { - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testParseMap() { assertNull(ShiftList.parseMap(null)); - assertNull(ShiftList.parseMap(new int[] - {})); - + assertNull(ShiftList.parseMap(new int[] {})); + /* * Gap map showing residues in aligned positions 2,3,6,8,9,10,12 */ - int[] gm = new int[] - { 2, 3, 6, 8, 9, 10, 12 }; + int[] gm = new int[] { 2, 3, 6, 8, 9, 10, 12 }; List shifts = ShiftList.parseMap(gm).getShifts(); assertEquals(4, shifts.size()); diff --git a/test/jalview/util/StringUtilsTest.java b/test/jalview/util/StringUtilsTest.java index e8de3bd..ece1fda 100644 --- a/test/jalview/util/StringUtilsTest.java +++ b/test/jalview/util/StringUtilsTest.java @@ -11,16 +11,14 @@ import org.testng.annotations.Test; public class StringUtilsTest { - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testInsertCharAt() { char[] c1 = "ABC".toCharArray(); - char[] expected = new char[] - { 'A', 'B', 'C', 'w', 'w' }; + char[] expected = new char[] { 'A', 'B', 'C', 'w', 'w' }; assertTrue(Arrays.equals(expected, StringUtils.insertCharAt(c1, 3, 2, 'w'))); - expected = new char[] - { 'A', 'B', 'C', 'w', 'w' }; + expected = new char[] { 'A', 'B', 'C', 'w', 'w' }; assertTrue(Arrays.equals(expected, StringUtils.insertCharAt(c1, 4, 2, 'w'))); assertTrue(Arrays.equals(expected, @@ -31,32 +29,32 @@ public class StringUtilsTest StringUtils.insertCharAt(c1, 7, 2, 'w'))); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testDeleteChars() { char[] c1 = "ABC".toCharArray(); // delete second position - assertTrue(Arrays.equals(new char[] - { 'A', 'C' }, StringUtils.deleteChars(c1, 1, 2))); + assertTrue(Arrays.equals(new char[] { 'A', 'C' }, + StringUtils.deleteChars(c1, 1, 2))); // delete positions 1 and 2 - assertTrue(Arrays.equals(new char[] - { 'C' }, StringUtils.deleteChars(c1, 0, 2))); + assertTrue(Arrays.equals(new char[] { 'C' }, + StringUtils.deleteChars(c1, 0, 2))); // delete positions 1-3 - assertTrue(Arrays.equals(new char[] - {}, StringUtils.deleteChars(c1, 0, 3))); + assertTrue(Arrays.equals(new char[] {}, + StringUtils.deleteChars(c1, 0, 3))); // delete position 3 - assertTrue(Arrays.equals(new char[] - { 'A', 'B' }, StringUtils.deleteChars(c1, 2, 3))); + assertTrue(Arrays.equals(new char[] { 'A', 'B' }, + StringUtils.deleteChars(c1, 2, 3))); // out of range deletion is ignore assertTrue(Arrays.equals(c1, StringUtils.deleteChars(c1, 3, 4))); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetLastToken() { assertNull(StringUtils.getLastToken(null, null)); @@ -69,7 +67,7 @@ public class StringUtilsTest "file://localhost:8080/data/examples/file1.dat", "/")); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testSeparatorListToArray() { String[] result = StringUtils.separatorListToArray( @@ -81,7 +79,7 @@ public class StringUtilsTest */ result = StringUtils.separatorListToArray("minsize='2', sep=','", ","); assertEquals("[minsize='2', sep=',']", Arrays.toString(result)); - + /* * String delimited by | containing a quoted | (should not be treated as * delimiter) @@ -90,18 +88,22 @@ public class StringUtilsTest .separatorListToArray("abc='|'d|ef|g", "|"))); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testArrayToSeparatorList() { assertEquals("*", StringUtils.arrayToSeparatorList(null, "*")); - assertEquals("*", StringUtils.arrayToSeparatorList(new String[] - {}, "*")); - assertEquals("a*bc*cde", StringUtils.arrayToSeparatorList(new String[] - { "a", "bc", "cde" }, "*")); - assertEquals("a*cde", StringUtils.arrayToSeparatorList(new String[] - { "a", null, "cde" }, "*")); - assertEquals("a**cde", StringUtils.arrayToSeparatorList(new String[] - { "a", "", "cde" }, "*")); + assertEquals("*", + StringUtils.arrayToSeparatorList(new String[] {}, "*")); + assertEquals( + "a*bc*cde", + StringUtils.arrayToSeparatorList(new String[] { "a", "bc", + "cde" }, "*")); + assertEquals( + "a*cde", + StringUtils.arrayToSeparatorList(new String[] { "a", null, + "cde" }, "*")); + assertEquals("a**cde", StringUtils.arrayToSeparatorList(new String[] { + "a", "", "cde" }, "*")); // delimiter within token is not (yet) escaped assertEquals("a*b*c*cde", StringUtils.arrayToSeparatorList(new String[] { "a", "b*c", "cde" }, "*")); diff --git a/test/jalview/viewmodel/styles/ViewStyleTest.java b/test/jalview/viewmodel/styles/ViewStyleTest.java index 9e259a9..dfb18bc 100644 --- a/test/jalview/viewmodel/styles/ViewStyleTest.java +++ b/test/jalview/viewmodel/styles/ViewStyleTest.java @@ -11,7 +11,6 @@ import java.util.Random; import org.testng.AssertJUnit; import org.testng.annotations.Test; - public class ViewStyleTest { @@ -30,7 +29,7 @@ public class ViewStyleTest * @throws IllegalAccessException * @throws IllegalArgumentException */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testCopyConstructor() throws IllegalArgumentException, IllegalAccessException { @@ -47,7 +46,8 @@ public class ViewStyleTest ViewStyle vs2 = new ViewStyle(vs1); - for (Field field1 : fields) { + for (Field field1 : fields) + { final Object value1 = field1.get(vs1); final Object value2 = field1.get(vs2); String msg = "Mismatch in " + field1.getName() + "(" + value1 + "/" @@ -137,8 +137,8 @@ public class ViewStyleTest } else { - AssertJUnit.fail("Unhandled field type (add to test): " + field.getName() - + ":" + type); + AssertJUnit.fail("Unhandled field type (add to test): " + + field.getName() + ":" + type); } } @@ -165,7 +165,7 @@ public class ViewStyleTest * @throws IllegalAccessException * @throws IllegalArgumentException */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testEquals() throws IllegalArgumentException, IllegalAccessException { diff --git a/test/jalview/ws/PDBSequenceFetcherTest.java b/test/jalview/ws/PDBSequenceFetcherTest.java index adf53f5..d020173 100644 --- a/test/jalview/ws/PDBSequenceFetcherTest.java +++ b/test/jalview/ws/PDBSequenceFetcherTest.java @@ -37,7 +37,7 @@ public class PDBSequenceFetcherTest SequenceFetcher sf; - @BeforeMethod(alwaysRun = true) + @BeforeMethod(alwaysRun = true) public void setUp() throws Exception { // ensure 'add annotation from structure' is selected @@ -57,8 +57,7 @@ public class PDBSequenceFetcherTest * * @throws Exception */ - @Test(groups = - { "Network" }, enabled = true) + @Test(groups = { "Network" }, enabled = true) public void testRnaSeqRetrieve() throws Exception { List sps = sf.getSourceProxy("PDB"); @@ -69,7 +68,8 @@ public class PDBSequenceFetcherTest { assertTrue("No annotation transfered to sequence.", sq.getAnnotation().length > 0); - assertTrue("No PDBEntry on sequence.", sq.getAllPDBEntries().size() > 0); + assertTrue("No PDBEntry on sequence.", + sq.getAllPDBEntries().size() > 0); assertTrue( "No RNA annotation on sequence, possibly http://arn-ibmc.in2p3.fr/api/compute/2d not available?", sq.getRNA() != null); diff --git a/test/jalview/ws/dbsources/PDBRestClientTest.java b/test/jalview/ws/dbsources/PDBRestClientTest.java index 9ae5b26..f8b1616 100644 --- a/test/jalview/ws/dbsources/PDBRestClientTest.java +++ b/test/jalview/ws/dbsources/PDBRestClientTest.java @@ -34,7 +34,7 @@ import com.sun.jersey.api.client.config.DefaultClientConfig; public class PDBRestClientTest { - @BeforeMethod(alwaysRun = true) + @BeforeMethod(alwaysRun = true) public void setUp() throws Exception { } @@ -44,8 +44,7 @@ public class PDBRestClientTest { } - @Test(groups = - { "External", "Network" }) + @Test(groups = { "External", "Network" }) public void executeRequestTest() { List wantedFields = new ArrayList(); @@ -77,7 +76,7 @@ public class PDBRestClientTest assertTrue(response.getSearchSummary().size() > 99); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void getPDBDocFieldsAsCommaDelimitedStringTest() { List wantedFields = new ArrayList(); @@ -94,8 +93,7 @@ public class PDBRestClientTest assertEquals("", expectedResult, actualResult); } - @Test(groups = - { "External, Network" }) + @Test(groups = { "External, Network" }) public void parsePDBJsonExceptionStringTest() { List wantedFields = new ArrayList(); @@ -133,8 +131,9 @@ public class PDBRestClientTest assertEquals(expectedErrorMsg, parsedErrorResponse); } - @Test(groups = - { "External", "Network" }, expectedExceptions = Exception.class) + @Test( + groups = { "External", "Network" }, + expectedExceptions = Exception.class) public void testForExpectedRuntimeException() throws Exception { List wantedFields = new ArrayList(); @@ -147,8 +146,7 @@ public class PDBRestClientTest new PDBRestClient().executeRequest(request); } - @Test(groups = - { "External" }) + @Test(groups = { "External" }) public void parsePDBJsonResponseTest() { List wantedFields = new ArrayList(); @@ -177,7 +175,7 @@ public class PDBRestClientTest assertTrue(response.getSearchSummary().size() == 14); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void getPDBIdColumIndexTest() { List wantedFields = new ArrayList(); @@ -190,8 +188,7 @@ public class PDBRestClientTest assertEquals(4, PDBRestClient.getPDBIdColumIndex(wantedFields, false)); } - @Test(groups = - { "External" }) + @Test(groups = { "External" }) public void externalServiceIntegrationTest() { ClientConfig clientConfig = new DefaultClientConfig(); @@ -274,7 +271,7 @@ public class PDBRestClientTest sb.append(line); sb.append(System.lineSeparator()); line = br.readLine(); - } + } fileContent = sb.toString(); } finally { diff --git a/test/jalview/ws/dbsources/UniprotTest.java b/test/jalview/ws/dbsources/UniprotTest.java index c89324b..ff1d0f2 100644 --- a/test/jalview/ws/dbsources/UniprotTest.java +++ b/test/jalview/ws/dbsources/UniprotTest.java @@ -35,7 +35,7 @@ public class UniprotTest /** * Test the method that unmarshals XML to a Uniprot model */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetUniprotEntries() { Uniprot u = new Uniprot(); @@ -53,8 +53,7 @@ public class UniprotTest /* * UniprotSequence drops any space characters */ - assertEquals("MHAPLVSKDL", entry.getUniprotSequence() - .getContent()); + assertEquals("MHAPLVSKDL", entry.getUniprotSequence().getContent()); assertEquals(2, entry.getProtein().getName().size()); assertEquals("Mitogen-activated protein kinase 13", entry.getProtein() @@ -108,7 +107,7 @@ public class UniprotTest /** * Test the method that formats the sequence name in Fasta style */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testConstructSequenceFastaHeader() { Uniprot u = new Uniprot(); diff --git a/test/jalview/ws/gui/Jws2ParamView.java b/test/jalview/ws/gui/Jws2ParamView.java index 294d426..1cf1e5f 100644 --- a/test/jalview/ws/gui/Jws2ParamView.java +++ b/test/jalview/ws/gui/Jws2ParamView.java @@ -74,8 +74,7 @@ public class Jws2ParamView * rather than hang */ - @Test(groups = - { "Interactive" }, enabled = true) + @Test(groups = { "Interactive" }, enabled = true) public void testJws2Gui() { Iterator presetEnum = presetTests.iterator(); @@ -121,8 +120,8 @@ public class Jws2ParamView WsJobParameters pgui = new WsJobParameters(service, new JabaPreset(service, pr)); JFrame jf = new JFrame(MessageManager.formatMessage( - "label.ws_parameters_for", new String[] - { service.getActionText() })); + "label.ws_parameters_for", + new String[] { service.getActionText() })); jf.setSize(700, 800); JPanel cont = new JPanel(new BorderLayout()); pgui.validate(); diff --git a/test/jalview/ws/jabaws/DisorderAnnotExportImport.java b/test/jalview/ws/jabaws/DisorderAnnotExportImport.java index 7b998c6..64840c2 100644 --- a/test/jalview/ws/jabaws/DisorderAnnotExportImport.java +++ b/test/jalview/ws/jabaws/DisorderAnnotExportImport.java @@ -81,7 +81,7 @@ public class DisorderAnnotExportImport { af.setVisible(false); af.dispose(); - af=null; + af = null; } } diff --git a/test/jalview/ws/jabaws/JalviewJabawsTestUtils.java b/test/jalview/ws/jabaws/JalviewJabawsTestUtils.java index 08bb405..5426fce 100644 --- a/test/jalview/ws/jabaws/JalviewJabawsTestUtils.java +++ b/test/jalview/ws/jabaws/JalviewJabawsTestUtils.java @@ -47,12 +47,11 @@ public class JalviewJabawsTestUtils /** * test servers */ - private static String[] serviceUrls = new String[] - { "http://localhost:8080/jabaws", + private static String[] serviceUrls = new String[] { + "http://localhost:8080/jabaws", "http://www.compbio.dundee.ac.uk/jabaws" }; - @Test(groups = - { "Functional" }, enabled = false) + @Test(groups = { "Functional" }, enabled = false) public void testAnnotExport() { fail("Not yet implemented"); @@ -62,6 +61,7 @@ public class JalviewJabawsTestUtils { return getJabawsDiscoverer(true); } + public static Jws2Discoverer getJabawsDiscoverer(boolean localhost) { jalview.ws.jws2.Jws2Discoverer disc = jalview.ws.jws2.Jws2Discoverer @@ -92,5 +92,4 @@ public class JalviewJabawsTestUtils return disc; } - } diff --git a/test/jalview/ws/jabaws/JpredJabaStructExportImport.java b/test/jalview/ws/jabaws/JpredJabaStructExportImport.java index e458876..afb24c4 100644 --- a/test/jalview/ws/jabaws/JpredJabaStructExportImport.java +++ b/test/jalview/ws/jabaws/JpredJabaStructExportImport.java @@ -94,7 +94,7 @@ public class JpredJabaStructExportImport } } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testJPredStructOneSeqOnly() { af.selectAllSequenceMenuItem_actionPerformed(null); @@ -146,7 +146,7 @@ public class JpredJabaStructExportImport } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testJPredStructExport() { @@ -217,7 +217,7 @@ public class JpredJabaStructExportImport + "\nCouldn't complete Annotation file roundtrip input/output/input test."); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testJpredwsSettingsRecovery() { Assert.fail("not implemnented"); diff --git a/test/jalview/ws/jabaws/MinJabawsClientTests.java b/test/jalview/ws/jabaws/MinJabawsClientTests.java index 61f8203..fe92b5a 100644 --- a/test/jalview/ws/jabaws/MinJabawsClientTests.java +++ b/test/jalview/ws/jabaws/MinJabawsClientTests.java @@ -18,40 +18,47 @@ import compbio.ws.client.Services; public class MinJabawsClientTests { - /** - * simple test for the benefit of JAL-1338 - * @throws Exception - */ - @SuppressWarnings("rawtypes") - @Test(groups = - { "Network" }) - public void msaTest() throws Exception { - String url; - RegistryWS registry = Jws2Client - .connectToRegistry(url = "http://www.compbio.dundee.ac.uk/jabaws"); - if (registry != null) { + /** + * simple test for the benefit of JAL-1338 + * + * @throws Exception + */ + @SuppressWarnings("rawtypes") + @Test(groups = { "Network" }) + public void msaTest() throws Exception + { + String url; + RegistryWS registry = Jws2Client + .connectToRegistry(url = "http://www.compbio.dundee.ac.uk/jabaws"); + if (registry != null) + { - MsaWS msaservice = null; - for (Services service : registry.getSupportedServices()) { - if (service.equals(Services.ClustalOWS)) { - msaservice = (MsaWS) Jws2Client.connect(url, service); - if (msaservice != null) { - break; - } - } - } - if (msaservice == null) { - Assert.fail("couldn't find a clustalO service on the public registry"); - } - FastaSequence fsq = new FastaSequence("seqA", - "SESESESESESESESSESESSESESESESESESESESESEEEEEESSESESESESSSSESESESESESESE"); - List iseqs = new ArrayList(); - for (int i = 0; i < 9; i++) { - iseqs.add(new FastaSequence(fsq.getId() + i, fsq.getSequence() - + fsq.getSequence().substring(i + 3, i + 3 + i))); - } + MsaWS msaservice = null; + for (Services service : registry.getSupportedServices()) + { + if (service.equals(Services.ClustalOWS)) + { + msaservice = (MsaWS) Jws2Client.connect(url, service); + if (msaservice != null) + { + break; + } + } + } + if (msaservice == null) + { + Assert.fail("couldn't find a clustalO service on the public registry"); + } + FastaSequence fsq = new FastaSequence("seqA", + "SESESESESESESESSESESSESESESESESESESESESEEEEEESSESESESESSSSESESESESESESE"); + List iseqs = new ArrayList(); + for (int i = 0; i < 9; i++) + { + iseqs.add(new FastaSequence(fsq.getId() + i, fsq.getSequence() + + fsq.getSequence().substring(i + 3, i + 3 + i))); + } - String jobid = msaservice.align(iseqs); + String jobid = msaservice.align(iseqs); if (jobid != null) { JobStatus js = null; @@ -86,8 +93,8 @@ public class MinJabawsClientTests // System.out.println(t.getFormattedFasta()); // } // }); - } + } - } - } + } + } } diff --git a/test/jalview/ws/jabaws/RNAStructExportImport.java b/test/jalview/ws/jabaws/RNAStructExportImport.java index 87a4ec6..b57e5d0 100644 --- a/test/jalview/ws/jabaws/RNAStructExportImport.java +++ b/test/jalview/ws/jabaws/RNAStructExportImport.java @@ -118,7 +118,7 @@ public class RNAStructExportImport } } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testRNAAliFoldValidStructure() { @@ -138,7 +138,7 @@ public class RNAStructExportImport } while (af.getViewport().getCalcManager().isWorking()); AlignmentI orig_alig = af.getViewport().getAlignment(); - for (AlignmentAnnotation aa:orig_alig.getAlignmentAnnotation()) + for (AlignmentAnnotation aa : orig_alig.getAlignmentAnnotation()) { if (alifoldClient.involves(aa)) { @@ -152,7 +152,7 @@ public class RNAStructExportImport } } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testRNAStructExport() { @@ -223,7 +223,7 @@ public class RNAStructExportImport + "\nCouldn't complete Annotation file roundtrip input/output/input test."); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testRnaalifoldSettingsRecovery() { List opts = new ArrayList(); diff --git a/test/jalview/ws/jws2/ParameterUtilsTest.java b/test/jalview/ws/jws2/ParameterUtilsTest.java index 523ccb3..f96b115 100644 --- a/test/jalview/ws/jws2/ParameterUtilsTest.java +++ b/test/jalview/ws/jws2/ParameterUtilsTest.java @@ -59,7 +59,7 @@ public class ParameterUtilsTest disc = JalviewJabawsTestUtils.getJabawsDiscoverer(); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testWriteParameterSet() throws WrongParameterException { for (Jws2Instance service : disc.getServices()) @@ -96,8 +96,8 @@ public class ParameterUtilsTest String on = o.next(); String sn = s.next(); String st = t.next(); - final String errorMsg = "Original was " + on + " Phase 1 wrote " + sn - + "\tPhase 2 wrote " + st; + final String errorMsg = "Original was " + on + + " Phase 1 wrote " + sn + "\tPhase 2 wrote " + st; assertEquals(errorMsg, sn, st); assertEquals(errorMsg, sn, on); } @@ -119,7 +119,7 @@ public class ParameterUtilsTest || serviceTests.contains(service.serviceType.toLowerCase()); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testCopyOption() { for (Jws2Instance service : disc.getServices()) @@ -143,7 +143,7 @@ public class ParameterUtilsTest /** */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testCopyParameter() { for (Jws2Instance service : disc.getServices()) diff --git a/test/jalview/ws/rest/RestClientTest.java b/test/jalview/ws/rest/RestClientTest.java index 7525acb..718567f 100644 --- a/test/jalview/ws/rest/RestClientTest.java +++ b/test/jalview/ws/rest/RestClientTest.java @@ -13,7 +13,7 @@ public class RestClientTest /** * Refactored 'as is' from main method */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetRestClient() { /* diff --git a/test/jalview/ws/rest/ShmmrRSBSService.java b/test/jalview/ws/rest/ShmmrRSBSService.java index 1f807b3..30383f7 100644 --- a/test/jalview/ws/rest/ShmmrRSBSService.java +++ b/test/jalview/ws/rest/ShmmrRSBSService.java @@ -36,7 +36,7 @@ import org.testng.annotations.Test; public class ShmmrRSBSService { - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testShmmrService() { @@ -46,7 +46,7 @@ public class ShmmrRSBSService RestClient.makeShmmrRestClient().service)); } - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testShmmrServiceDataprep() throws Exception { RestClient _rc = RestClient.makeShmmrRestClient(); diff --git a/test/jalview/ws/seqfetcher/DasSequenceFetcher.java b/test/jalview/ws/seqfetcher/DasSequenceFetcher.java index 148cb9e..d9a2a79 100644 --- a/test/jalview/ws/seqfetcher/DasSequenceFetcher.java +++ b/test/jalview/ws/seqfetcher/DasSequenceFetcher.java @@ -6,13 +6,15 @@ import org.testng.annotations.Test; public class DasSequenceFetcher { - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testDasRegistryContact() { jalview.bin.Cache.getDasSourceRegistry().refreshSources(); - AssertJUnit.assertTrue( - "Expected to find at least one DAS source at the registry. Check config.", - jalview.bin.Cache.getDasSourceRegistry().getSources().size() > 0); + AssertJUnit + .assertTrue( + "Expected to find at least one DAS source at the registry. Check config.", + jalview.bin.Cache.getDasSourceRegistry().getSources() + .size() > 0); } } diff --git a/test/jalview/ws/seqfetcher/DbRefFetcherTest.java b/test/jalview/ws/seqfetcher/DbRefFetcherTest.java index 1171bfd..ddd8b33 100644 --- a/test/jalview/ws/seqfetcher/DbRefFetcherTest.java +++ b/test/jalview/ws/seqfetcher/DbRefFetcherTest.java @@ -70,7 +70,7 @@ public class DbRefFetcherTest * and also PDB. (Additional sources are dependent on available of DAS * services.) */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testStandardProtDbs() { String[] defdb = DBRefSource.PROTEINDBS; @@ -116,12 +116,12 @@ public class DbRefFetcherTest * * @throws Exception */ - @Test(groups = - { "External" }) + @Test(groups = { "External" }) public void testEmblUniprotProductRecovery() throws Exception { String retrievalId = "V00488"; - DbSourceProxy embl = new SequenceFetcher().getSourceProxy(DBRefSource.EMBL).get(0); + DbSourceProxy embl = new SequenceFetcher().getSourceProxy( + DBRefSource.EMBL).get(0); assertNotNull("Couldn't find the EMBL retrieval client", embl); verifyProteinNucleotideXref(retrievalId, embl); } @@ -132,8 +132,7 @@ public class DbRefFetcherTest * * @throws Exception */ - @Test(groups = - { "External" }) + @Test(groups = { "External" }) public void testEmblCDSUniprotProductRecovery() throws Exception { String retrievalId = "AAH29712"; @@ -155,7 +154,8 @@ public class DbRefFetcherTest { AlignmentI alsq = embl.getSequenceRecords(retrievalId); assertNotNull("Couldn't find the EMBL record " + retrievalId, alsq); - assertEquals("Didn't retrieve right number of records", 1, alsq.getHeight()); + assertEquals("Didn't retrieve right number of records", 1, + alsq.getHeight()); SequenceI seq = alsq.getSequenceAt(0); assertEquals("Wrong sequence name", embl.getDbSource() + "|" + retrievalId, seq.getName()); @@ -166,14 +166,17 @@ public class DbRefFetcherTest FeatureProperties.isCodingFeature(embl.getDbSource(), sfs[0].getType())); assertEquals(embl.getDbSource(), sfs[0].getFeatureGroup()); - DBRefEntry[] dr = DBRefUtils.selectRefs(seq.getDBRef(), DBRefSource.PROTEINSEQ); + DBRefEntry[] dr = DBRefUtils.selectRefs(seq.getDBRef(), + DBRefSource.PROTEINSEQ); assertNotNull(dr); assertEquals("Expected a single Uniprot cross reference", 1, dr.length); assertEquals("Expected cross reference map to be one amino acid", dr[0] .getMap().getMappedWidth(), 1); assertEquals("Expected local reference map to be 3 nucleotides", dr[0] .getMap().getWidth(), 3); - AlignmentI sprods = CrossRef.findXrefSequences(alsq.getSequencesArray(), true, dr[0].getSource(), alsq.getDataset()); + AlignmentI sprods = CrossRef.findXrefSequences( + alsq.getSequencesArray(), true, dr[0].getSource(), + alsq.getDataset()); assertNotNull( "Couldn't recover cross reference sequence from dataset. Was it ever added ?", sprods);