Merge branch 'develop' into spike/JAL-4047/JAL-4048_columns_in_sequenceID
[jalview.git] / test / jalview / io / StockholmFileTest.java
index b1995ab..10f368a 100644 (file)
@@ -137,6 +137,31 @@ public class StockholmFileTest
 
   }
 
+  @Test(groups = { "Functional" })
+  public void descriptionLineOutput() throws Exception
+  {
+    // quick test that sequence description is exported & reimported
+
+    SequenceI sq = new Sequence("FER2_SPIOL", "AASSDDDFFF");
+    String expected_descr = "This is a description !@&^%@£@";
+    sq.setDescription(expected_descr);
+    AppletFormatAdapter af = new AppletFormatAdapter();
+    String toStockholm = af.formatSequences(FileFormat.Stockholm,
+            new Alignment(new SequenceI[]
+            { sq }), false);
+    System.out.println(toStockholm);
+
+    // bleh - java.util.Regex sucks
+    assertTrue(toStockholm.contains(expected_descr),
+            "Couldn't locate expected description srting in generated Stockholm file.");
+
+    AlignmentI fromStockholm = af.readFile(toStockholm,
+            DataSourceType.PASTE, FileFormat.Stockholm);
+    SequenceI importedSeq = fromStockholm.getSequenceAt(0);
+    assertEquals("Description did not get reimported.", expected_descr,
+            importedSeq.getDescription());
+  }
+
   /**
    * test alignment data in given file can be imported, exported and reimported
    * with no dataloss