Add testing dirs
[proteocache.git] / testsrc / compbio / data / sequence / FastaSequenceTester.java
diff --git a/testsrc/compbio/data/sequence/FastaSequenceTester.java b/testsrc/compbio/data/sequence/FastaSequenceTester.java
new file mode 100644 (file)
index 0000000..eaeac43
--- /dev/null
@@ -0,0 +1,41 @@
+/* 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
+\r
+import org.testng.annotations.Test;\r
+\r
+public class FastaSequenceTester {\r
+\r
+       @Test()\r
+       public void testGetFormattedFasta() {\r
+               FastaSequence fs = new FastaSequence(\r
+                               "test",\r
+                               "kjashf asjkdfhjkahsdfkadf fewyweyrfhjajfasdjkfkjhasdjkfaskhdfjhasdjkf "\r
+                                               + "hdflhdghuetirwhglhasdghfjkhdfs gdsfkjghsdjfgjhdsfglkhskdjfgjhjsdkfgkhsdjkfghsdkjfgh "\r
+                                               + "sdfjglkjhsdflkjg sdfgklhsdkfgdfkjghjkshgdflsdfgjkshdfghksdjfgkjhsdfgjkh");\r
+               assertEquals(219, fs.getSequence().length());\r
+               assertEquals(11, fs.getFormatedSequence(20).split("\n").length);\r
+               assertEquals(3, fs.getFormatedSequence(80).split("\n").length);\r
+               fs = new FastaSequence("test", "kjashf f ");\r
+               assertEquals(1, fs.getFormatedSequence(80).split("\n").length);\r
+               assertEquals(7, fs.getFormatedSequence(1).split("\n").length);\r
+       }\r
+}\r