X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fanalysis%2FTestAlignSeq.java;h=70e59c53bc8433e69f2d0bfabe7ff84199e4116a;hb=136c0793b90b72b928c4d77dc109dd5c644e00d3;hp=59740dfad35134d364efb6699a8a8bd0fe9ac31c;hpb=aea8e62db4be70d2ebee5df313c285894f7ce342;p=jalview.git diff --git a/test/jalview/analysis/TestAlignSeq.java b/test/jalview/analysis/TestAlignSeq.java index 59740df..70e59c5 100644 --- a/test/jalview/analysis/TestAlignSeq.java +++ b/test/jalview/analysis/TestAlignSeq.java @@ -1,70 +1,134 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) - * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ 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. + * 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 . + * 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.analysis; -import static org.junit.Assert.*; +import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertNull; + import jalview.datamodel.Mapping; import jalview.datamodel.Sequence; import jalview.datamodel.SequenceI; +import jalview.gui.JvOptionPane; + +import java.io.PrintStream; -import org.junit.Before; -import org.junit.Test; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; /** * Test the alignment -> Mapping routines + * * @author jimp - * + * */ public class TestAlignSeq { - SequenceI s1,s2,s3; + @BeforeClass(alwaysRun = true) + public void setUpJvOptionPane() + { + JvOptionPane.setInteractiveMode(false); + JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); + } + + SequenceI s1, s2, s3; + /** * @throws java.lang.Exception */ - @Before + @BeforeMethod(alwaysRun = true) public void setUp() throws Exception { - s1 = new Sequence("Seq1","ASDFAQQQRRRSSS"); + s1 = new Sequence("Seq1", "ASDFAQQQRRRSSS"); s1.setStart(3); - s2 = new Sequence("Seq2","ASDFA"); + s1.setEnd(18); + s2 = new Sequence("Seq2", "ASDFA"); s2.setStart(5); - s3 = new Sequence("Seq1","SDFAQQQSSS"); + s2.setEnd(9); + s3 = new Sequence("Seq1", "SDFAQQQSSS"); } - @Test + @Test(groups = { "Functional" }) /** * simple test that mapping from alignment corresponds identical positions. */ - public void TestGetMappingForS1() + public void testGetMappingForS1() { - jalview.analysis.AlignSeq as = jalview.analysis.AlignSeq.doGlobalNWAlignment(s1, s2, AlignSeq.PEP); - System.out.println("s1: "+as.getAStr1()); - System.out.println("s2: "+as.getAStr2()); - - Mapping s1tos2=as.getMappingFromS1(false); + AlignSeq as = AlignSeq.doGlobalNWAlignment(s1, s2, AlignSeq.PEP); + System.out.println("s1: " + as.getAStr1()); + System.out.println("s2: " + as.getAStr2()); + + // aligned results match + assertEquals("ASDFA", as.getAStr1()); + assertEquals(as.getAStr1(), as.getAStr2()); + + Mapping s1tos2 = as.getMappingFromS1(false); System.out.println(s1tos2.getMap().toString()); - for (int i=s2.getStart();i