X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fdatamodel%2FAlignmentTest.java;h=f5f271d4bb14fa4062f75dd896244ac5553419b2;hb=17e77c3f2949a0729322b4a8d907f3f34b6a9914;hp=df98af9ff3a308f36b8ff0c2f353729407df55df;hpb=be32c14cd8e48fe0a207cd7030cb9cd46f894678;p=jalview.git diff --git a/test/jalview/datamodel/AlignmentTest.java b/test/jalview/datamodel/AlignmentTest.java index df98af9..f5f271d 100644 --- a/test/jalview/datamodel/AlignmentTest.java +++ b/test/jalview/datamodel/AlignmentTest.java @@ -1,8 +1,29 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9) + * Copyright (C) 2015 The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.datamodel; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertFalse; +import static org.testng.AssertJUnit.assertTrue; + import jalview.io.AppletFormatAdapter; import jalview.io.FormatAdapter; import jalview.util.MapList; @@ -10,8 +31,8 @@ import jalview.util.MapList; import java.io.IOException; import java.util.Iterator; -import org.junit.Before; -import org.junit.Test; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; /** * Unit tests for Alignment datamodel. @@ -68,7 +89,7 @@ public class AlignmentTest protected AlignmentI loadAlignment(final String data, String format) throws IOException { - Alignment a = new FormatAdapter().readFile(data, + AlignmentI a = new FormatAdapter().readFile(data, AppletFormatAdapter.PASTE, format); a.setDataset(null); return a; @@ -78,7 +99,7 @@ public class AlignmentTest * Read in Stockholm format test data including secondary structure * annotations. */ - @Before + @BeforeMethod(alwaysRun = true) public void setUp() throws IOException { al = loadAlignment(TEST_DATA, "STH"); @@ -93,7 +114,7 @@ public class AlignmentTest /** * Test method that returns annotations that match on calcId. */ - @Test + @Test(groups = { "Functional" }) public void testFindAnnotation_byCalcId() { Iterable anns = al @@ -105,7 +126,7 @@ public class AlignmentTest assertFalse(iter.hasNext()); } - @Test + @Test(groups = { "Functional" }) public void testDeleteAllAnnotations_includingAutocalculated() { AlignmentAnnotation aa = new AlignmentAnnotation("Consensus", @@ -119,7 +140,7 @@ public class AlignmentTest assertEquals("Not all deleted", 0, al.getAlignmentAnnotation().length); } - @Test + @Test(groups = { "Functional" }) public void testDeleteAllAnnotations_excludingAutocalculated() { AlignmentAnnotation aa = new AlignmentAnnotation("Consensus", @@ -143,7 +164,7 @@ public class AlignmentTest * * @throws IOException */ - @Test + @Test(groups = { "Functional" }) public void testAlignAs_dnaAsDna() throws IOException { // aligned cDNA: @@ -156,9 +177,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); @@ -175,16 +194,14 @@ public class AlignmentTest * * @throws IOException */ - @Test + @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); @@ -199,7 +216,7 @@ public class AlignmentTest * * @throws IOException */ - @Test + @Test(groups = { "Functional" }) public void testAlignAs_cdnaAsProtein() throws IOException { /* @@ -208,9 +225,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); @@ -231,7 +246,7 @@ public class AlignmentTest * * @throws IOException */ - @Test + @Test(groups = { "Functional" }) public void testAlignAs_dnaAsProtein_withIntrons() throws IOException { /* @@ -246,13 +261,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);