Add testing dirs
[proteocache.git] / testsrc / compbio / data / sequence / FastaSequenceGeneratorTester.java
diff --git a/testsrc/compbio/data/sequence/FastaSequenceGeneratorTester.java b/testsrc/compbio/data/sequence/FastaSequenceGeneratorTester.java
new file mode 100644 (file)
index 0000000..374a052
--- /dev/null
@@ -0,0 +1,44 @@
+/* Copyright (c) 2009 Peter Troshin\r
+ *  \r
+ *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0     \r
+ * \r
+ *  This library is free software; you can redistribute it and/or modify it under the terms of the\r
+ *  Apache License version 2 as published by the Apache Software Foundation\r
+ * \r
+ *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
+ *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
+ *  License for more details.\r
+ * \r
+ *  A copy of the license is in apache_license.txt. It is also available here:\r
+ * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
+ * \r
+ * Any republication or derived work distributed in source code form\r
+ * must include this copyright and license notice.\r
+ */\r
+\r
+package compbio.data.sequence;\r
+\r
+import static org.testng.AssertJUnit.assertEquals;\r
+import static org.testng.AssertJUnit.assertTrue;\r
+\r
+import java.util.List;\r
+\r
+import org.testng.annotations.Test;\r
+\r
+public class FastaSequenceGeneratorTester {\r
+\r
+       @Test()\r
+       public void testProteinSequenceGeneration() {\r
+               FastaSequenceGenerator fs = new FastaSequenceGenerator(\r
+                               FastaSequenceGenerator.SeqType.PROTEIN, 100);\r
+               assertEquals(100, fs.generateFasta(100).size());\r
+\r
+               fs = new FastaSequenceGenerator(FastaSequenceGenerator.SeqType.DNA, 50);\r
+               List<FastaSequence> flist = fs.generateFasta(100);\r
+               assertEquals(50, flist.size());\r
+               for (FastaSequence s : flist) {\r
+                       assertTrue(s.getLength() >= 50);\r
+               }\r
+\r
+       }\r
+}\r