\r
import java.io.FileInputStream;\r
import java.io.FileNotFoundException;\r
-import java.io.FileOutputStream;\r
+import java.io.FileWriter;\r
import java.io.IOException;\r
+import java.io.Writer;\r
\r
import org.testng.annotations.Test;\r
\r
\r
public class ClustalAlignmentUtilTester {\r
\r
- @Test()\r
- public void testReadClustalFile() {\r
- try {\r
- readWriteClustal("TO1381.aln");\r
- } catch (FileNotFoundException e) {\r
- e.printStackTrace();\r
- fail(e.getMessage());\r
- } catch (Exception e) {\r
- e.printStackTrace();\r
- fail(e.getMessage());\r
+ @Test()\r
+ public void testReadClustalFile() {\r
+ try {\r
+ readWriteClustal("TO1381.aln");\r
+ } catch (FileNotFoundException e) {\r
+ e.printStackTrace();\r
+ fail(e.getMessage());\r
+ } catch (Exception e) {\r
+ e.printStackTrace();\r
+ fail(e.getMessage());\r
+ }\r
}\r
- }\r
\r
- static void readWriteClustal(String fname) throws IOException,\r
- UnknownFileFormatException {\r
- FileInputStream fio = new FileInputStream(AllTestSuit.TEST_DATA_PATH\r
- + fname);\r
- Alignment seqAl = ClustalAlignmentUtil.readClustalFile(fio);\r
- assertTrue(seqAl != null);\r
- assertTrue(seqAl.getSize() == 3);\r
- assertNotNull(seqAl.getSequences());\r
- assertEquals(3, seqAl.getSequences().size());\r
+ static void readWriteClustal(String fname) throws IOException,\r
+ UnknownFileFormatException {\r
+ FileInputStream fio = new FileInputStream(AllTestSuit.TEST_DATA_PATH\r
+ + fname);\r
+ Alignment seqAl = ClustalAlignmentUtil.readClustalFile(fio);\r
+ assertTrue(seqAl != null);\r
+ assertTrue(seqAl.getSize() == 3);\r
+ assertNotNull(seqAl.getSequences());\r
+ assertEquals(3, seqAl.getSequences().size());\r
\r
- // Now try to write the alignment read\r
- FileOutputStream os = new FileOutputStream(AllTestSuit.TEST_DATA_PATH\r
- + fname + ".written");\r
- ClustalAlignmentUtil.writeClustalAlignment(os, seqAl);\r
- fio.close();\r
- os.close();\r
+ // Now try to write the alignment read\r
+ Writer os = new FileWriter(AllTestSuit.TEST_DATA_PATH + fname\r
+ + ".written");\r
+ ClustalAlignmentUtil.writeClustalAlignment(os, seqAl);\r
+ fio.close();\r
+ os.close();\r
\r
- fio = new FileInputStream(AllTestSuit.TEST_DATA_PATH + fname\r
- + ".written");\r
- Alignment readseqs = ClustalAlignmentUtil.readClustalFile(fio);\r
- assertTrue(readseqs != null);\r
- assertTrue(readseqs.getSize() == 3);\r
- fio.close();\r
- }\r
+ fio = new FileInputStream(AllTestSuit.TEST_DATA_PATH + fname\r
+ + ".written");\r
+ Alignment readseqs = ClustalAlignmentUtil.readClustalFile(fio);\r
+ assertTrue(readseqs != null);\r
+ assertTrue(readseqs.getSize() == 3);\r
+ fio.close();\r
+ }\r
\r
- @Test()\r
- public void testReadClustalFileShortNames() {\r
- try {\r
- readWriteClustal("TO1381s.aln");\r
- } catch (FileNotFoundException e) {\r
- e.printStackTrace();\r
- fail(e.getMessage());\r
- } catch (Exception e) {\r
- e.printStackTrace();\r
- fail(e.getMessage());\r
+ @Test()\r
+ public void testReadClustalFileShortNames() {\r
+ try {\r
+ readWriteClustal("TO1381s.aln");\r
+ } catch (FileNotFoundException e) {\r
+ e.printStackTrace();\r
+ fail(e.getMessage());\r
+ } catch (Exception e) {\r
+ e.printStackTrace();\r
+ fail(e.getMessage());\r
+ }\r
}\r
- }\r
\r
- @Test()\r
- public void testReadClustalFileLongNames() {\r
- try {\r
- readWriteClustal("TO1381L.aln");\r
- } catch (FileNotFoundException e) {\r
- e.printStackTrace();\r
- fail(e.getMessage());\r
- } catch (Exception e) {\r
- e.printStackTrace();\r
- fail(e.getMessage());\r
+ @Test()\r
+ public void testReadClustalFileLongNames() {\r
+ try {\r
+ readWriteClustal("TO1381L.aln");\r
+ } catch (FileNotFoundException e) {\r
+ e.printStackTrace();\r
+ fail(e.getMessage());\r
+ } catch (Exception e) {\r
+ e.printStackTrace();\r
+ fail(e.getMessage());\r
+ }\r
}\r
- }\r
\r
}\r