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