From 7f6b9bd1d7bde3279468d87a205a01f729787d75 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Wed, 23 May 2018 16:49:53 +0100 Subject: [PATCH] JAL-2997 unit test --- test/jalview/io/ClustalFileTest.java | 39 ++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 test/jalview/io/ClustalFileTest.java diff --git a/test/jalview/io/ClustalFileTest.java b/test/jalview/io/ClustalFileTest.java new file mode 100644 index 0000000..a912d96 --- /dev/null +++ b/test/jalview/io/ClustalFileTest.java @@ -0,0 +1,39 @@ +package jalview.io; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertTrue; + +import jalview.datamodel.SequenceI; + +import java.io.IOException; + +import org.testng.annotations.Test; + +public class ClustalFileTest +{ + @Test(groups="Functional") + public void testParse_withNumbering() throws IOException + { + //@formatter:off + String data = "CLUSTAL\n\n" + + "FER_CAPAA/1-8 -----------------------------------------------------------A\t1\n" + + "FER_CAPAN/1-55 MA------SVSATMISTSFMPRKPAVTSL-KPIPNVGE--ALFGLKS-A--NGGKVTCMA 48\n" + + "FER1_SOLLC/1-55 MA------SISGTMISTSFLPRKPAVTSL-KAISNVGE--ALFGLKS-G--RNGRITCMA 48\n" + + "Q93XJ9_SOLTU/1-55 MA------SISGTMISTSFLPRKPVVTSL-KAISNVGE--ALFGLKS-G--RNGRITCMA 48\n" + + "FER1_PEA/1-60 MATT---PALYGTAVSTSFLRTQPMPMSV-TTTKAFSN--GFLGLKT-SLKRGDLAVAMA 53\n\n" + + "FER_CAPAA/1-8 SYKVKLI 8\n" + + "FER_CAPAN/1-55 SYKVKLI 55\n" + + "FER1_SOLLC/1-55 SYKVKLI 55\n" + + "Q93XJ9_SOLTU/1-55 SYKVKLI 55\n" + + "FER1_PEA/1-60 SYKVKLV 60\n"; + //@formatter:on + ClustalFile cf = new ClustalFile(data, DataSourceType.PASTE); + cf.parse(); + SequenceI[] seqs = cf.getSeqsAsArray(); + assertEquals(seqs.length, 5); + assertEquals(seqs[0].getName(), "FER_CAPAA"); + assertEquals(seqs[0].getStart(), 1); + assertEquals(seqs[0].getEnd(), 8); + assertTrue(seqs[0].getSequenceAsString().endsWith("ASYKVKLI")); + } +} -- 1.7.10.2