1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.io; |
22 |
|
|
23 |
|
import static org.testng.Assert.assertEquals; |
24 |
|
import static org.testng.Assert.assertNotNull; |
25 |
|
import static org.testng.Assert.assertNotSame; |
26 |
|
import static org.testng.Assert.assertNull; |
27 |
|
import static org.testng.Assert.assertSame; |
28 |
|
|
29 |
|
import java.io.File; |
30 |
|
|
31 |
|
import javax.swing.ImageIcon; |
32 |
|
|
33 |
|
import org.testng.annotations.Test; |
34 |
|
|
|
|
| 0% |
Uncovered Elements: 46 (46) |
Complexity: 3 |
Complexity Density: 0.07 |
|
35 |
|
public class JalviewFileViewTest |
36 |
|
{ |
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 1 |
Complexity Density: 0.08 |
4-
|
|
37 |
0 |
@Test(groups = "Functional")... |
38 |
|
public void testGetImageIcon() |
39 |
|
{ |
40 |
0 |
JalviewFileView jfv = new JalviewFileView(); |
41 |
0 |
ImageIcon icon1 = jfv.getImageIcon("/images/file.png"); |
42 |
0 |
ImageIcon icon2 = jfv.getImageIcon("/images/file.png"); |
43 |
0 |
ImageIcon icon3 = jfv.getImageIcon("/images/dna.png"); |
44 |
0 |
ImageIcon icon4 = jfv.getImageIcon("/images/dna.png"); |
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
0 |
assertNotNull(icon1); |
50 |
0 |
assertSame(icon1, icon2); |
51 |
0 |
assertNotNull(icon3); |
52 |
0 |
assertSame(icon3, icon4); |
53 |
0 |
assertNotSame(icon1, icon3); |
54 |
|
|
55 |
0 |
assertNull(jfv.getImageIcon("/images/nosuchfile.png")); |
56 |
0 |
assertNull(jfv.getImageIcon("images/file.png")); |
57 |
|
} |
58 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
4-
|
|
59 |
0 |
@Test(groups = "Functional")... |
60 |
|
public void testGetExtension() |
61 |
|
{ |
62 |
0 |
assertEquals(JalviewFileView.getExtension(new File("text.txt")), "txt"); |
63 |
0 |
assertEquals(JalviewFileView.getExtension( |
64 |
|
new File("/a/longer/file/path/text.png.TXT")), "txt"); |
65 |
0 |
assertNull(JalviewFileView |
66 |
|
.getExtension(new File("/a/longer/file/path/text."))); |
67 |
0 |
assertNull(JalviewFileView |
68 |
|
.getExtension(new File("/a/longer/file/path/text"))); |
69 |
|
} |
70 |
|
|
|
|
| 0% |
Uncovered Elements: 27 (27) |
Complexity: 1 |
Complexity Density: 0.04 |
4-
|
|
71 |
0 |
@Test(groups = "Functional")... |
72 |
|
public void testGetTypeDescription() |
73 |
|
{ |
74 |
0 |
JalviewFileView jfw = new JalviewFileView(); |
75 |
0 |
assertEquals(jfw.getTypeDescription(new File("uniref50.fa")), |
76 |
|
"Fasta file"); |
77 |
0 |
assertEquals(jfw.getTypeDescription(new File("uniref50.fasta")), |
78 |
|
"Fasta file"); |
79 |
0 |
assertEquals(jfw.getTypeDescription(new File("uniref50.MFA")), |
80 |
|
"Fasta file"); |
81 |
0 |
assertEquals(jfw.getTypeDescription(new File("uniref50.fastQ")), |
82 |
|
"Fasta file"); |
83 |
0 |
assertEquals(jfw.getTypeDescription(new File("uniref50.pfam")), |
84 |
|
"PFAM file"); |
85 |
0 |
assertEquals(jfw.getTypeDescription(new File("uniref50.stk")), |
86 |
|
"Stockholm file"); |
87 |
0 |
assertEquals(jfw.getTypeDescription(new File("uniref50.sto")), |
88 |
|
"Stockholm file"); |
89 |
0 |
assertEquals(jfw.getTypeDescription(new File("uniref50.pir")), |
90 |
|
"PIR file"); |
91 |
0 |
assertEquals(jfw.getTypeDescription(new File("uniref50.blc")), |
92 |
|
"BLC file"); |
93 |
0 |
assertEquals(jfw.getTypeDescription(new File("uniref50.amsa")), |
94 |
|
"AMSA file"); |
95 |
0 |
assertEquals(jfw.getTypeDescription(new File("uniref50.html")), |
96 |
|
"HTML file"); |
97 |
0 |
assertNull(jfw.getTypeDescription(new File("uniref50.htm"))); |
98 |
0 |
assertEquals(jfw.getTypeDescription(new File("uniref50.xml")), |
99 |
|
"RNAML file"); |
100 |
0 |
assertEquals(jfw.getTypeDescription(new File("uniref50.rnaml")), |
101 |
|
"RNAML file"); |
102 |
0 |
assertEquals(jfw.getTypeDescription(new File("uniref50.json")), |
103 |
|
"JSON file"); |
104 |
0 |
assertEquals(jfw.getTypeDescription(new File("uniref50.pileup")), |
105 |
|
"PileUp file"); |
106 |
0 |
assertEquals(jfw.getTypeDescription(new File("uniref50.msf")), |
107 |
|
"MSF file"); |
108 |
0 |
assertEquals(jfw.getTypeDescription(new File("uniref50.aln")), |
109 |
|
"Clustal file"); |
110 |
0 |
assertEquals(jfw.getTypeDescription(new File("uniref50.phy")), |
111 |
|
"PHYLIP file"); |
112 |
0 |
assertEquals(jfw.getTypeDescription(new File("uniref50.gff2")), |
113 |
|
"GFF or Jalview features file"); |
114 |
0 |
assertEquals(jfw.getTypeDescription(new File("uniref50.gff3")), |
115 |
|
"GFF or Jalview features file"); |
116 |
0 |
assertEquals(jfw.getTypeDescription(new File("uniref50.pdb")), |
117 |
|
"PDB file"); |
118 |
0 |
assertEquals(jfw.getTypeDescription(new File("uniref50.ent")), |
119 |
|
"PDB file"); |
120 |
0 |
assertEquals(jfw.getTypeDescription(new File("uniref50.cif")), |
121 |
|
"mmCIF file"); |
122 |
0 |
assertEquals(jfw.getTypeDescription(new File("uniref50.jvp")), |
123 |
|
"Jalview file"); |
124 |
0 |
assertEquals(jfw.getTypeDescription(new File("uniref50.jar")), |
125 |
|
"Jalview file (old)"); |
126 |
|
} |
127 |
|
} |