c958ff09be88988455b468da9e882366dc680b7d
[jalview.git] / test / jalview / io / IdentifyFileTest.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3  * Copyright (C) $$Year-Rel$$ The Jalview Authors
4  * 
5  * This file is part of Jalview.
6  * 
7  * Jalview is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License 
9  * as published by the Free Software Foundation, either version 3
10  * of the License, or (at your option) any later version.
11  *  
12  * Jalview is distributed in the hope that it will be useful, but 
13  * WITHOUT ANY WARRANTY; without even the implied warranty 
14  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
15  * PURPOSE.  See the GNU General Public License for more details.
16  * 
17  * You should have received a copy of the GNU General Public License
18  * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
19  * The Jalview Authors are detailed in the 'AUTHORS' file.
20  */
21 package jalview.io;
22
23 import org.testng.Assert;
24 import org.testng.annotations.DataProvider;
25 import org.testng.annotations.Test;
26
27 public class IdentifyFileTest
28 {
29
30   @Test(groups = { "Functional" }, dataProvider = "identifyFiles")
31   public void Identify(String data, String expectedFileType)
32   {
33     String protocol = AppletFormatAdapter.FILE;
34     IdentifyFile ider = new IdentifyFile();
35     String actualFiletype = ider.Identify(data, protocol);
36     Assert.assertEquals(actualFiletype, expectedFileType,
37             "File identification Failed!");
38   }
39
40   @DataProvider(name = "identifyFiles")
41   public Object[][] IdentifyFileDP()
42   {
43     return new Object[][] {
44         { "examples/example.json", "JSON" },
45         { "examples/plantfdx.fa", "FASTA" },
46         { "examples/dna_interleaved.phy", "PHYLIP" },
47         { "examples/2GIS.pdb", "PDB" },
48         { "examples/rf00031_folded.stk", "STH" },
49         { "examples/testdata/test.rnaml", "RNAML" },
50         { "examples/testdata/test.aln", "CLUSTAL" },
51         { "examples/testdata/test.pfam", "PFAM" },
52         { "examples/testdata/test.msf", "MSF" },
53         { "examples/testdata/test.pir", "PIR" },
54         { "examples/testdata/test.html", "HTML" },
55         { "examples/testdata/test.pileup", "PileUp" },
56         { "examples/testdata/test.blc", "BLC" },
57         { "examples/testdata/simplegff3.gff", "GFF v2 or v3" },
58         { "examples/testdata/test.jvp", "Jalview" },
59         {
60             "examples/testdata/cullpdb_pc25_res3.0_R0.3_d150729_chains9361.fasta.15316",
61             "FASTA" },
62
63     // { "examples/testdata/test.amsa", "AMSA" },
64     // { "examples/test.jnet", "JnetFile" },
65     };
66   }
67
68 }