From: BobHanson Date: Tue, 2 Jun 2020 18:14:54 +0000 (-0500) Subject: JAL-3446 JAL-3253 JAL-3445 BSML bbb XML format reader (preliminary) test X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2FJalview-JS%2Fdevelop.JAL-3445-BSML-reader;p=jalview.git JAL-3446 JAL-3253 JAL-3445 BSML bbb XML format reader (preliminary) test --- diff --git a/test/jalview/io/BSMLFileTest.java b/test/jalview/io/BSMLFileTest.java new file mode 100644 index 0000000..3052658 --- /dev/null +++ b/test/jalview/io/BSMLFileTest.java @@ -0,0 +1,68 @@ +package jalview.io; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertTrue; + +import jalview.datamodel.SequenceFeature; +import jalview.datamodel.SequenceI; +import jalview.datamodel.features.SequenceFeaturesI; + +import java.io.IOException; +import java.util.List; + +import org.testng.annotations.Test; + +public class BSMLFileTest +{ + @Test(groups="Functional") + public void testParse_BSML() throws IOException + { + //@formatter:off + String data = "\r\n" + + "\r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " --AATTTT-ATTTAGTGTCT-----------\r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + "\r\n" + + ""; + BSMLFile cf = new BSMLFile(data, DataSourceType.PASTE); +// why twice? cf.parse(); + SequenceI[] seqs = cf.getSeqsAsArray(); + assertEquals(seqs.length, 1); + SequenceI seq = seqs[0]; + assertEquals(seq.getName(), "EP1"); + assertEquals(seq.getStart(), 1); + assertEquals(seq.getEnd(), 31); + assertTrue(seq.getSequenceAsString().equals("--AATTTT-ATTTAGTGTCT-----------")); + SequenceFeaturesI features = seq.getFeatures(); + List genes = features.getAllFeatures("GENE"); + assertEquals(genes.size(), 1); + SequenceFeature sf = genes.get(0); + assertEquals(sf.getDescription(), "TEST-001"); + assertEquals(sf.begin + "," + sf.end, "10,20"); + + } + +}