1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.ws.ebi; |
22 |
|
|
23 |
|
import static org.testng.AssertJUnit.assertEquals; |
24 |
|
import static org.testng.AssertJUnit.assertNull; |
25 |
|
|
26 |
|
import jalview.gui.JvOptionPane; |
27 |
|
|
28 |
|
import org.testng.annotations.BeforeClass; |
29 |
|
import org.testng.annotations.Test; |
30 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (39) |
Complexity: 3 |
Complexity Density: 0.08 |
|
31 |
|
public class EBIFetchClientTest |
32 |
|
{ |
33 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
34 |
1 |
@BeforeClass(alwaysRun = true)... |
35 |
|
public void setUpJvOptionPane() |
36 |
|
{ |
37 |
1 |
JvOptionPane.setInteractiveMode(false); |
38 |
1 |
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); |
39 |
|
} |
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
44 |
1 |
@Test(groups = "Functional")... |
45 |
|
public void testBuildUrl() |
46 |
|
{ |
47 |
|
|
48 |
|
|
49 |
|
|
50 |
1 |
assertEquals( |
51 |
|
"https://www.ebi.ac.uk/ena/browser/api/embl/x53838?download=true&gzip=true", |
52 |
|
EBIFetchClient.buildUrl("X53838", "EMBL", "display=xml")); |
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
1 |
assertEquals( |
58 |
|
"https://www.ebi.ac.uk/ena/browser/api/embl/caa37824?download=true&gzip=true", |
59 |
|
EBIFetchClient.buildUrl("CAA37824", "EMBL", "display=xml")); |
60 |
|
|
61 |
|
|
62 |
|
|
63 |
|
|
64 |
1 |
assertEquals("https://www.ebi.ac.uk/Tools/dbfetch/dbfetch/pdb/3a6s/pdb", |
65 |
|
EBIFetchClient.buildUrl("3A6S", "PDB", "pdb")); |
66 |
|
|
67 |
|
|
68 |
|
|
69 |
|
|
70 |
1 |
assertEquals( |
71 |
|
"https://www.ebi.ac.uk/Tools/dbfetch/dbfetch/pdb/3a6s/mmCIF", |
72 |
|
EBIFetchClient.buildUrl("3A6S", "PDB", "mmCIF")); |
73 |
|
} |
74 |
|
|
75 |
|
|
76 |
|
|
77 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (30) |
Complexity: 1 |
Complexity Density: 0.03 |
1PASS
|
|
78 |
1 |
@Test(groups = "Functional")... |
79 |
|
public void testParseIds() |
80 |
|
{ |
81 |
|
|
82 |
|
|
83 |
|
|
84 |
1 |
StringBuilder queries = new StringBuilder(); |
85 |
1 |
String db = EBIFetchClient.parseIds("pdb:3a6s;1A70", queries); |
86 |
1 |
assertEquals("pdb", db); |
87 |
1 |
assertEquals("3a6s,1A70", queries.toString()); |
88 |
|
|
89 |
|
|
90 |
|
|
91 |
|
|
92 |
1 |
queries.setLength(0); |
93 |
1 |
queries = new StringBuilder(); |
94 |
1 |
db = EBIFetchClient.parseIds("3a6s;pdb:1A70", queries); |
95 |
1 |
assertEquals("pdb", db); |
96 |
1 |
assertEquals("3a6s,1A70", queries.toString()); |
97 |
|
|
98 |
|
|
99 |
|
|
100 |
|
|
101 |
1 |
queries.setLength(0); |
102 |
1 |
db = EBIFetchClient.parseIds("uniprot:P00340", queries); |
103 |
1 |
assertEquals("uniprot", db); |
104 |
1 |
assertEquals("P00340", queries.toString()); |
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
|
109 |
1 |
queries.setLength(0); |
110 |
1 |
queries.append("P30419"); |
111 |
1 |
db = EBIFetchClient.parseIds("uniprot:P00340", queries); |
112 |
1 |
assertEquals("uniprot", db); |
113 |
1 |
assertEquals("P30419,P00340", queries.toString()); |
114 |
|
|
115 |
|
|
116 |
|
|
117 |
|
|
118 |
1 |
queries.setLength(0); |
119 |
1 |
db = EBIFetchClient.parseIds("pdb:3a6s;1a70;uniprot:P00340", queries); |
120 |
1 |
assertNull(db); |
121 |
1 |
assertEquals("3a6s,1a70", queries.toString()); |
122 |
|
|
123 |
|
|
124 |
|
|
125 |
|
|
126 |
1 |
queries.setLength(0); |
127 |
1 |
db = EBIFetchClient.parseIds("pdb:3a6s;pdb:1a70;PDB:1QIP", queries); |
128 |
1 |
assertEquals("PDB", db); |
129 |
1 |
assertEquals("3a6s,1a70,1QIP", queries.toString()); |
130 |
|
|
131 |
|
|
132 |
|
|
133 |
|
|
134 |
1 |
queries.setLength(0); |
135 |
1 |
db = EBIFetchClient.parseIds("P00340", queries); |
136 |
1 |
assertNull(db); |
137 |
1 |
assertEquals("P00340", queries.toString()); |
138 |
|
} |
139 |
|
} |