--- /dev/null
+package compbio.stat.collector;\r
+\r
+import java.io.File;\r
+import java.io.IOException;\r
+\r
+import org.testng.Assert;\r
+import org.testng.annotations.Test;\r
+\r
+import compbio.metadata.AllTestSuit;\r
+\r
+public class TestInputFilter {\r
+\r
+ final static String FASTA_INPUT = AllTestSuit.TEST_DATA_PATH_ABSOLUTE\r
+ + "TO1381.fasta";\r
+ final static String ALN_INPUT = AllTestSuit.TEST_DATA_PATH_ABSOLUTE\r
+ + "TO1381L.aln";\r
+ final static String TEST_FASTA_INPUT = AllTestSuit.TEST_DATA_PATH_ABSOLUTE\r
+ + "test_input.fasta";\r
+ final static String TEST_ALIGNMENT_INPUT = AllTestSuit.TEST_DATA_PATH_ABSOLUTE\r
+ + "test_input.aln";\r
+ @Test\r
+ public void TestInputFilter() {\r
+ InputFilter ifilter = new InputFilter();\r
+ try {\r
+ // Makes sure real files are accepted\r
+ Assert.assertTrue(ifilter.accept(new File(FASTA_INPUT)));\r
+ Assert.assertTrue(ifilter.accept(new File(ALN_INPUT)));\r
+\r
+ // .. and test files are not\r
+ Assert.assertFalse(ifilter.accept(new File(TEST_ALIGNMENT_INPUT)));\r
+ Assert.assertFalse(ifilter.accept(new File(TEST_FASTA_INPUT)));\r
+ // does not matter if the file is empty, it is still not a test\r
+ // file!\r
+ Assert.assertTrue(ifilter.accept(File.createTempFile("aaa", "bbb")));\r
+ } catch (IOException e) {\r
+ e.printStackTrace();\r
+ Assert.fail(e.getMessage());\r
+ }\r
+ }\r
+}\r