JAL-1819 Test cases for Identify file
[jalview.git] / test / jalview / io / IdentifyFileTest.java
diff --git a/test/jalview/io/IdentifyFileTest.java b/test/jalview/io/IdentifyFileTest.java
new file mode 100644 (file)
index 0000000..1c34e1f
--- /dev/null
@@ -0,0 +1,45 @@
+package jalview.io;
+
+import org.testng.Assert;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+public class IdentifyFileTest {
+
+  @Test(groups =
+  { "Functional" }, dataProvider = "identifyFiles")
+  public void Identify(String data, String expectedFileType)
+  {
+    String protocol = AppletFormatAdapter.FILE;
+    IdentifyFile ider = new IdentifyFile();
+    String actualFiletype = ider.Identify(data, protocol);
+    Assert.assertEquals(actualFiletype, expectedFileType,
+            "File identification Failed!");
+  }
+
+  @DataProvider(name = "identifyFiles")
+  public Object[][] IdentifyFileDP()
+  {
+    return new Object[][]
+    {
+    { "examples/example.json", "JSON" },
+    { "examples/plantfdx.fa", "FASTA" },
+    { "examples/dna_interleaved.phy", "PHYLIP" },
+    { "examples/2GIS.pdb", "PDB" },
+    { "examples/rf00031_folded.stk", "STH" },
+    { "examples/testdata/test.rnaml", "RNAML" },
+    { "examples/testdata/test.aln", "CLUSTAL" },
+    { "examples/testdata/test.pfam", "PFAM" },
+    { "examples/testdata/test.msf", "MSF" },
+    { "examples/testdata/test.pir", "PIR" },
+    { "examples/testdata/test.html", "HTML" },
+    { "examples/testdata/test.pileup", "PileUp" },
+    { "examples/testdata/test.blc", "BLC" },
+    { "examples/testdata/simplegff3.gff", "GFF v2 or v3" },
+    { "examples/testdata/test.jvp", "Jalview" },
+    // { "examples/testdata/test.amsa", "AMSA" },
+    // { "examples/test.jnet", "JnetFile" },
+    };
+  }
+
+}