1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.gui; |
22 |
|
|
23 |
|
import static org.testng.Assert.assertEquals; |
24 |
|
import static org.testng.Assert.assertFalse; |
25 |
|
import static org.testng.Assert.assertNull; |
26 |
|
import static org.testng.Assert.assertSame; |
27 |
|
import static org.testng.Assert.assertTrue; |
28 |
|
|
29 |
|
import jalview.datamodel.PDBEntry; |
30 |
|
import jalview.datamodel.PDBEntry.Type; |
31 |
|
import jalview.datamodel.Sequence; |
32 |
|
import jalview.datamodel.SequenceI; |
33 |
|
|
34 |
|
import java.util.Map; |
35 |
|
|
36 |
|
import org.testng.annotations.BeforeClass; |
37 |
|
import org.testng.annotations.Test; |
38 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (42) |
Complexity: 3 |
Complexity Density: 0.08 |
|
39 |
|
public class StructureViewerTest |
40 |
|
{ |
41 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
42 |
1 |
@BeforeClass(alwaysRun = true)... |
43 |
|
public void setUpJvOptionPane() |
44 |
|
{ |
45 |
1 |
JvOptionPane.setInteractiveMode(false); |
46 |
1 |
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); |
47 |
|
} |
48 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (38) |
Complexity: 2 |
Complexity Density: 0.06 |
1PASS
|
|
49 |
1 |
@Test(groups = "Functional")... |
50 |
|
public void testGetSequencesForPdbs() |
51 |
|
{ |
52 |
1 |
StructureViewer sv = new StructureViewer(null); |
53 |
|
|
54 |
1 |
assertNull(sv.getSequencesForPdbs(null, null)); |
55 |
|
|
56 |
1 |
PDBEntry pdbe1 = new PDBEntry("1A70", "A", Type.PDB, "path1"); |
57 |
1 |
PDBEntry pdbe2 = new PDBEntry("3A6S", "A", Type.PDB, "path2"); |
58 |
1 |
PDBEntry pdbe3 = new PDBEntry("1A70", "B", Type.PDB, "path1"); |
59 |
1 |
PDBEntry pdbe4 = new PDBEntry("1GAQ", "A", Type.PDB, null); |
60 |
1 |
PDBEntry pdbe5 = new PDBEntry("3A6S", "B", Type.PDB, "path2"); |
61 |
1 |
PDBEntry pdbe6 = new PDBEntry("1GAQ", "B", Type.PDB, null); |
62 |
1 |
PDBEntry pdbe7 = new PDBEntry("1FOO", "Q", Type.PDB, null); |
63 |
|
|
64 |
1 |
PDBEntry[] pdbs = new PDBEntry[] { pdbe1, pdbe2, pdbe3, pdbe4, pdbe5, |
65 |
|
pdbe6, pdbe7 }; |
66 |
|
|
67 |
|
|
68 |
|
|
69 |
|
|
70 |
1 |
SequenceI[] seqs = new SequenceI[pdbs.length]; |
71 |
8 |
for (int i = 0; i < seqs.length; i++) |
72 |
|
{ |
73 |
7 |
seqs[i] = new Sequence("Seq" + i, "abc"); |
74 |
|
} |
75 |
|
|
76 |
|
|
77 |
|
|
78 |
|
|
79 |
1 |
Map<PDBEntry, SequenceI[]> uniques = sv.getSequencesForPdbs(pdbs, seqs); |
80 |
1 |
assertTrue(uniques.containsKey(pdbe1)); |
81 |
1 |
assertTrue(uniques.containsKey(pdbe2)); |
82 |
1 |
assertFalse(uniques.containsKey(pdbe3)); |
83 |
1 |
assertTrue(uniques.containsKey(pdbe4)); |
84 |
1 |
assertFalse(uniques.containsKey(pdbe5)); |
85 |
1 |
assertFalse(uniques.containsKey(pdbe6)); |
86 |
1 |
assertTrue(uniques.containsKey(pdbe7)); |
87 |
|
|
88 |
|
|
89 |
1 |
SequenceI[] ss = uniques.get(pdbe1); |
90 |
1 |
assertEquals(ss.length, 2); |
91 |
1 |
assertSame(seqs[0], ss[0]); |
92 |
1 |
assertSame(seqs[2], ss[1]); |
93 |
|
|
94 |
|
|
95 |
1 |
ss = uniques.get(pdbe2); |
96 |
1 |
assertEquals(ss.length, 2); |
97 |
1 |
assertSame(seqs[1], ss[0]); |
98 |
1 |
assertSame(seqs[4], ss[1]); |
99 |
|
|
100 |
|
|
101 |
1 |
ss = uniques.get(pdbe4); |
102 |
1 |
assertEquals(ss.length, 2); |
103 |
1 |
assertSame(seqs[3], ss[0]); |
104 |
1 |
assertSame(seqs[5], ss[1]); |
105 |
|
|
106 |
|
|
107 |
1 |
ss = uniques.get(pdbe7); |
108 |
1 |
assertEquals(ss.length, 1); |
109 |
1 |
assertSame(seqs[6], ss[0]); |
110 |
|
} |
111 |
|
} |