1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.util; |
22 |
|
|
23 |
|
import static jalview.util.UrlConstants.DB_ACCESSION; |
24 |
|
import static jalview.util.UrlConstants.SEQUENCE_ID; |
25 |
|
import static org.testng.AssertJUnit.assertEquals; |
26 |
|
import static org.testng.AssertJUnit.assertFalse; |
27 |
|
import static org.testng.AssertJUnit.assertNull; |
28 |
|
import static org.testng.AssertJUnit.assertTrue; |
29 |
|
|
30 |
|
import jalview.datamodel.DBRefEntry; |
31 |
|
import jalview.datamodel.DBRefSource; |
32 |
|
import jalview.datamodel.Sequence; |
33 |
|
import jalview.gui.JvOptionPane; |
34 |
|
|
35 |
|
import java.util.ArrayList; |
36 |
|
import java.util.Comparator; |
37 |
|
import java.util.LinkedHashMap; |
38 |
|
import java.util.List; |
39 |
|
import java.util.Map; |
40 |
|
|
41 |
|
import org.testng.annotations.BeforeClass; |
42 |
|
import org.testng.annotations.Test; |
43 |
|
|
|
|
| 0% |
Uncovered Elements: 233 (233) |
Complexity: 10 |
Complexity Density: 0.04 |
|
44 |
|
public class UrlLinkTest |
45 |
|
{ |
46 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
47 |
0 |
@BeforeClass(alwaysRun = true)... |
48 |
|
public void setUpJvOptionPane() |
49 |
|
{ |
50 |
0 |
JvOptionPane.setInteractiveMode(false); |
51 |
0 |
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); |
52 |
|
} |
53 |
|
|
54 |
|
final static String DB = "Test"; |
55 |
|
|
56 |
|
final static String URL_PREFIX = "http://www.jalview.org/"; |
57 |
|
|
58 |
|
final static String URL_SUFFIX = "/blah"; |
59 |
|
|
60 |
|
final static String SEP = "|"; |
61 |
|
|
62 |
|
final static String DELIM = "$"; |
63 |
|
|
64 |
|
final static String REGEX_NESTED = "=/^(?:Label:)?(?:(?:gi\\|(\\d+))|([^:]+))/="; |
65 |
|
|
66 |
|
final static String REGEX_RUBBISH = "=/[0-9]++/="; |
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
|
|
|
| 0% |
Uncovered Elements: 29 (29) |
Complexity: 1 |
Complexity Density: 0.03 |
4-
|
|
71 |
0 |
@Test(groups = { "Functional" })... |
72 |
|
public void testUrlLinkCreationNoRegex() |
73 |
|
{ |
74 |
|
|
75 |
0 |
UrlLink ul = new UrlLink(DB + SEP + URL_PREFIX + DELIM + SEQUENCE_ID |
76 |
|
+ DELIM + URL_SUFFIX); |
77 |
0 |
assertEquals(DB, ul.getTarget()); |
78 |
0 |
assertEquals(DB, ul.getLabel()); |
79 |
0 |
assertEquals(URL_PREFIX, ul.getUrlPrefix()); |
80 |
0 |
assertEquals(URL_SUFFIX, ul.getUrlSuffix()); |
81 |
0 |
assertTrue(ul.isDynamic()); |
82 |
0 |
assertFalse(ul.usesDBAccession()); |
83 |
0 |
assertNull(ul.getRegexReplace()); |
84 |
0 |
assertTrue(ul.isValid()); |
85 |
0 |
assertNull(ul.getInvalidMessage()); |
86 |
|
|
87 |
|
|
88 |
0 |
ul = new UrlLink(DB + SEP + URL_PREFIX + DELIM + DB_ACCESSION + DELIM |
89 |
|
+ URL_SUFFIX); |
90 |
0 |
assertEquals(DB, ul.getTarget()); |
91 |
0 |
assertEquals(DB, ul.getLabel()); |
92 |
0 |
assertEquals(URL_PREFIX, ul.getUrlPrefix()); |
93 |
0 |
assertEquals(URL_SUFFIX, ul.getUrlSuffix()); |
94 |
0 |
assertTrue(ul.isDynamic()); |
95 |
0 |
assertTrue(ul.usesDBAccession()); |
96 |
0 |
assertNull(ul.getRegexReplace()); |
97 |
0 |
assertTrue(ul.isValid()); |
98 |
0 |
assertNull(ul.getInvalidMessage()); |
99 |
|
|
100 |
|
|
101 |
0 |
ul = new UrlLink(DB + SEP + URL_PREFIX + URL_SUFFIX.substring(1)); |
102 |
0 |
assertEquals(DB, ul.getTarget()); |
103 |
0 |
assertEquals(DB, ul.getLabel()); |
104 |
0 |
assertEquals(URL_PREFIX + URL_SUFFIX.substring(1), ul.getUrlPrefix()); |
105 |
0 |
assertFalse(ul.isDynamic()); |
106 |
0 |
assertFalse(ul.usesDBAccession()); |
107 |
0 |
assertNull(ul.getRegexReplace()); |
108 |
0 |
assertTrue(ul.isValid()); |
109 |
0 |
assertNull(ul.getInvalidMessage()); |
110 |
|
} |
111 |
|
|
112 |
|
|
113 |
|
|
114 |
|
|
|
|
| 0% |
Uncovered Elements: 30 (30) |
Complexity: 1 |
Complexity Density: 0.03 |
4-
|
|
115 |
0 |
@Test(groups = { "Functional" })... |
116 |
|
public void testUrlLinkCreationWithRegex() |
117 |
|
{ |
118 |
|
|
119 |
0 |
UrlLink ul = new UrlLink(DB + SEP + URL_PREFIX + DELIM + SEQUENCE_ID |
120 |
|
+ REGEX_NESTED + DELIM + URL_SUFFIX); |
121 |
0 |
assertEquals(DB, ul.getTarget()); |
122 |
0 |
assertEquals(DB, ul.getLabel()); |
123 |
0 |
assertEquals(URL_PREFIX, ul.getUrlPrefix()); |
124 |
0 |
assertEquals(URL_SUFFIX, ul.getUrlSuffix()); |
125 |
0 |
assertTrue(ul.isDynamic()); |
126 |
0 |
assertFalse(ul.usesDBAccession()); |
127 |
0 |
assertEquals(REGEX_NESTED.substring(2, REGEX_NESTED.length() - 2), |
128 |
|
ul.getRegexReplace()); |
129 |
0 |
assertTrue(ul.isValid()); |
130 |
0 |
assertNull(ul.getInvalidMessage()); |
131 |
|
|
132 |
|
|
133 |
0 |
ul = new UrlLink(DB + SEP + URL_PREFIX + DELIM + DB_ACCESSION |
134 |
|
+ REGEX_NESTED + DELIM + URL_SUFFIX); |
135 |
0 |
assertEquals(DB, ul.getTarget()); |
136 |
0 |
assertEquals(DB, ul.getLabel()); |
137 |
0 |
assertEquals(URL_PREFIX, ul.getUrlPrefix()); |
138 |
0 |
assertEquals(URL_SUFFIX, ul.getUrlSuffix()); |
139 |
0 |
assertTrue(ul.isDynamic()); |
140 |
0 |
assertTrue(ul.usesDBAccession()); |
141 |
0 |
assertEquals(REGEX_NESTED.substring(2, REGEX_NESTED.length() - 2), |
142 |
|
ul.getRegexReplace()); |
143 |
0 |
assertTrue(ul.isValid()); |
144 |
0 |
assertNull(ul.getInvalidMessage()); |
145 |
|
|
146 |
|
|
147 |
0 |
ul = new UrlLink(DB + SEP + URL_PREFIX + DELIM + DB_ACCESSION |
148 |
|
+ REGEX_RUBBISH + DELIM + URL_SUFFIX); |
149 |
0 |
assertEquals(DB, ul.getTarget()); |
150 |
0 |
assertEquals(DB, ul.getLabel()); |
151 |
0 |
assertEquals(URL_PREFIX, ul.getUrlPrefix()); |
152 |
0 |
assertEquals(URL_SUFFIX, ul.getUrlSuffix()); |
153 |
0 |
assertTrue(ul.isDynamic()); |
154 |
0 |
assertTrue(ul.usesDBAccession()); |
155 |
0 |
assertEquals(REGEX_RUBBISH.substring(2, REGEX_RUBBISH.length() - 2), |
156 |
|
ul.getRegexReplace()); |
157 |
0 |
assertFalse(ul.isValid()); |
158 |
0 |
assertEquals("Invalid Regular Expression : '" |
159 |
|
+ REGEX_RUBBISH.substring(2, REGEX_RUBBISH.length() - 2) |
160 |
|
+ "'\n", ul.getInvalidMessage()); |
161 |
|
} |
162 |
|
|
163 |
|
|
164 |
|
|
165 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 1 |
Complexity Density: 0.1 |
4-
|
|
166 |
0 |
@Test(groups = { "Functional" })... |
167 |
|
public void testMakeUrlNoRegex() |
168 |
|
{ |
169 |
|
|
170 |
0 |
UrlLink ul = new UrlLink(DB + SEP + URL_PREFIX + DELIM + SEQUENCE_ID |
171 |
|
+ DELIM + URL_SUFFIX); |
172 |
0 |
String idstring = "FER_CAPAA"; |
173 |
0 |
String[] urls = ul.makeUrls(idstring, true); |
174 |
|
|
175 |
0 |
assertEquals(2, urls.length); |
176 |
0 |
assertEquals(idstring, urls[0]); |
177 |
0 |
assertEquals(URL_PREFIX + idstring + URL_SUFFIX, urls[1]); |
178 |
|
|
179 |
0 |
urls = ul.makeUrls(idstring, false); |
180 |
|
|
181 |
0 |
assertEquals(2, urls.length); |
182 |
0 |
assertEquals(idstring, urls[0]); |
183 |
0 |
assertEquals(URL_PREFIX + idstring + URL_SUFFIX, urls[1]); |
184 |
|
} |
185 |
|
|
186 |
|
|
187 |
|
|
188 |
|
|
189 |
|
|
|
|
| 0% |
Uncovered Elements: 49 (49) |
Complexity: 1 |
Complexity Density: 0.02 |
4-
|
|
190 |
0 |
@Test(groups = { "Functional" })... |
191 |
|
public void testMakeUrlWithRegex() |
192 |
|
{ |
193 |
|
|
194 |
0 |
UrlLink ul = new UrlLink(DB + SEP + URL_PREFIX + DELIM + DB_ACCESSION |
195 |
|
+ REGEX_NESTED + DELIM + URL_SUFFIX); |
196 |
0 |
String idstring = "FER_CAPAA"; |
197 |
0 |
String[] urls = ul.makeUrls(idstring, true); |
198 |
|
|
199 |
0 |
assertEquals(2, urls.length); |
200 |
0 |
assertEquals(idstring, urls[0]); |
201 |
0 |
assertEquals(URL_PREFIX + idstring + URL_SUFFIX, urls[1]); |
202 |
0 |
assertTrue(ul.isValid()); |
203 |
0 |
assertNull(ul.getInvalidMessage()); |
204 |
|
|
205 |
0 |
urls = ul.makeUrls(idstring, false); |
206 |
|
|
207 |
0 |
assertEquals(2, urls.length); |
208 |
0 |
assertEquals(idstring, urls[0]); |
209 |
0 |
assertEquals(URL_PREFIX + idstring + URL_SUFFIX, urls[1]); |
210 |
0 |
assertTrue(ul.isValid()); |
211 |
0 |
assertNull(ul.getInvalidMessage()); |
212 |
|
|
213 |
|
|
214 |
0 |
idstring = "Label:gi|9234|pdb|102L|A"; |
215 |
0 |
urls = ul.makeUrls(idstring, true); |
216 |
|
|
217 |
0 |
assertEquals(2, urls.length); |
218 |
0 |
assertEquals("9234", urls[0]); |
219 |
0 |
assertEquals(URL_PREFIX + "9234" + URL_SUFFIX, urls[1]); |
220 |
0 |
assertTrue(ul.isValid()); |
221 |
0 |
assertNull(ul.getInvalidMessage()); |
222 |
|
|
223 |
0 |
urls = ul.makeUrls(idstring, false); |
224 |
|
|
225 |
0 |
assertEquals(2, urls.length); |
226 |
0 |
assertEquals("9234", urls[0]); |
227 |
0 |
assertEquals(URL_PREFIX + "9234" + URL_SUFFIX, urls[1]); |
228 |
0 |
assertTrue(ul.isValid()); |
229 |
0 |
assertNull(ul.getInvalidMessage()); |
230 |
|
|
231 |
|
|
232 |
0 |
idstring = "this does not match"; |
233 |
0 |
urls = ul.makeUrls(idstring, true); |
234 |
|
|
235 |
0 |
assertEquals(2, urls.length); |
236 |
0 |
assertEquals(idstring, urls[0]); |
237 |
0 |
assertEquals(URL_PREFIX + idstring + URL_SUFFIX, urls[1]); |
238 |
0 |
assertTrue(ul.isValid()); |
239 |
0 |
assertNull(ul.getInvalidMessage()); |
240 |
|
|
241 |
0 |
urls = ul.makeUrls(idstring, false); |
242 |
|
|
243 |
0 |
assertEquals(2, urls.length); |
244 |
0 |
assertEquals(idstring, urls[0]); |
245 |
0 |
assertEquals(URL_PREFIX + idstring + URL_SUFFIX, urls[1]); |
246 |
0 |
assertTrue(ul.isValid()); |
247 |
0 |
assertNull(ul.getInvalidMessage()); |
248 |
|
|
249 |
|
|
250 |
0 |
idstring = ""; |
251 |
0 |
urls = ul.makeUrls(idstring, true); |
252 |
|
|
253 |
0 |
assertNull(urls); |
254 |
|
|
255 |
0 |
urls = ul.makeUrls(idstring, false); |
256 |
|
|
257 |
0 |
assertEquals(2, urls.length); |
258 |
0 |
assertEquals("", urls[0]); |
259 |
0 |
assertEquals(URL_PREFIX + URL_SUFFIX, urls[1]); |
260 |
0 |
assertTrue(ul.isValid()); |
261 |
0 |
assertNull(ul.getInvalidMessage()); |
262 |
|
} |
263 |
|
|
264 |
|
|
265 |
|
|
266 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 1 |
Complexity Density: 0.1 |
4-
|
|
267 |
0 |
@Test(groups = { "Functional" })... |
268 |
|
public void testCreateLinksFromNullSequence() |
269 |
|
{ |
270 |
0 |
UrlLink ul = new UrlLink(DB + SEP + URL_PREFIX + DELIM + SEQUENCE_ID |
271 |
|
+ DELIM + URL_SUFFIX); |
272 |
|
|
273 |
0 |
Map<String, List<String>> linkset = new LinkedHashMap<>(); |
274 |
0 |
ul.createLinksFromSeq(null, linkset); |
275 |
|
|
276 |
0 |
String key = DB + SEP + URL_PREFIX; |
277 |
0 |
assertEquals(1, linkset.size()); |
278 |
0 |
assertTrue(linkset.containsKey(key)); |
279 |
0 |
assertEquals(DB, linkset.get(key).get(0)); |
280 |
0 |
assertEquals(DB, linkset.get(key).get(1)); |
281 |
0 |
assertEquals(null, linkset.get(key).get(2)); |
282 |
0 |
assertEquals(URL_PREFIX, linkset.get(key).get(3)); |
283 |
|
} |
284 |
|
|
285 |
|
|
286 |
|
|
287 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 1 |
Complexity Density: 0.1 |
4-
|
|
288 |
0 |
@Test(groups = { "Functional" })... |
289 |
|
public void testCreateLinksForNonDynamic() |
290 |
|
{ |
291 |
0 |
UrlLink ul = new UrlLink(DB + SEP + URL_PREFIX + URL_SUFFIX); |
292 |
|
|
293 |
0 |
Map<String, List<String>> linkset = new LinkedHashMap<>(); |
294 |
0 |
ul.createLinksFromSeq(null, linkset); |
295 |
|
|
296 |
0 |
String key = DB + SEP + URL_PREFIX + URL_SUFFIX; |
297 |
0 |
assertEquals(1, linkset.size()); |
298 |
0 |
assertTrue(linkset.containsKey(key)); |
299 |
0 |
assertEquals(DB, linkset.get(key).get(0)); |
300 |
0 |
assertEquals(DB, linkset.get(key).get(1)); |
301 |
0 |
assertEquals(null, linkset.get(key).get(2)); |
302 |
0 |
assertEquals(URL_PREFIX + URL_SUFFIX, linkset.get(key).get(3)); |
303 |
|
} |
304 |
|
|
305 |
|
|
306 |
|
|
307 |
|
|
|
|
| 0% |
Uncovered Elements: 61 (61) |
Complexity: 1 |
Complexity Density: 0.02 |
4-
|
|
308 |
0 |
@Test(groups = { "Functional" })... |
309 |
|
public void testCreateLinksFromSequence() |
310 |
|
{ |
311 |
|
|
312 |
|
|
313 |
0 |
List<String> links = new ArrayList<>(); |
314 |
0 |
List<DBRefEntry> refs = new ArrayList<>(); |
315 |
|
|
316 |
|
|
317 |
0 |
links.add( |
318 |
|
"EMBL-EBI Search | http://www.ebi.ac.uk/ebisearch/search.ebi?db=allebi&query=$" |
319 |
|
+ SEQUENCE_ID + "$"); |
320 |
0 |
links.add("UNIPROT | http://www.uniprot.org/uniprot/$" + DB_ACCESSION |
321 |
|
+ "$"); |
322 |
0 |
links.add("INTERPRO | http://www.ebi.ac.uk/interpro/entry/$" |
323 |
|
+ DB_ACCESSION + "$"); |
324 |
|
|
325 |
|
|
326 |
0 |
refs.add(new DBRefEntry(DBRefSource.UNIPROT, "1", "P83527")); |
327 |
0 |
refs.add(new DBRefEntry("INTERPRO", "1", "IPR001041")); |
328 |
0 |
refs.add(new DBRefEntry("INTERPRO", "1", "IPR006058")); |
329 |
0 |
refs.add(new DBRefEntry("INTERPRO", "1", "IPR012675")); |
330 |
|
|
331 |
0 |
Sequence seq0 = new Sequence("FER1", "AKPNGVL"); |
332 |
|
|
333 |
|
|
334 |
0 |
seq0.addDBRef(refs.get(0)); |
335 |
0 |
seq0.addDBRef(refs.get(1)); |
336 |
0 |
seq0.addDBRef(refs.get(2)); |
337 |
0 |
seq0.addDBRef(refs.get(3)); |
338 |
0 |
seq0.createDatasetSequence(); |
339 |
|
|
340 |
|
|
341 |
0 |
UrlLink ul = new UrlLink(DB + SEP + URL_PREFIX + DELIM + SEQUENCE_ID |
342 |
|
+ DELIM + URL_SUFFIX); |
343 |
|
|
344 |
0 |
Map<String, List<String>> linkset = new LinkedHashMap<>(); |
345 |
0 |
ul.createLinksFromSeq(seq0, linkset); |
346 |
|
|
347 |
0 |
String key = seq0.getName() + SEP + URL_PREFIX + seq0.getName() |
348 |
|
+ URL_SUFFIX; |
349 |
0 |
assertEquals(1, linkset.size()); |
350 |
0 |
assertTrue(linkset.containsKey(key)); |
351 |
0 |
assertEquals(DB, linkset.get(key).get(0)); |
352 |
0 |
assertEquals(DB, linkset.get(key).get(1)); |
353 |
0 |
assertEquals(seq0.getName(), linkset.get(key).get(2)); |
354 |
0 |
assertEquals(URL_PREFIX + seq0.getName() + URL_SUFFIX, |
355 |
|
linkset.get(key).get(3)); |
356 |
|
|
357 |
|
|
358 |
0 |
ul = new UrlLink(links.get(1)); |
359 |
0 |
linkset = new LinkedHashMap<>(); |
360 |
0 |
ul.createLinksFromSeq(seq0, linkset); |
361 |
|
|
362 |
0 |
key = "P83527|http://www.uniprot.org/uniprot/P83527"; |
363 |
0 |
assertEquals(linkset.size(), 1); |
364 |
0 |
assertTrue(linkset.containsKey(key)); |
365 |
0 |
assertEquals(DBRefSource.UNIPROT, linkset.get(key).get(0)); |
366 |
0 |
assertEquals(DBRefSource.UNIPROT + SEP + "P83527", |
367 |
|
linkset.get(key).get(1)); |
368 |
0 |
assertEquals("P83527", linkset.get(key).get(2)); |
369 |
0 |
assertEquals("http://www.uniprot.org/uniprot/P83527", |
370 |
|
linkset.get(key).get(3)); |
371 |
|
|
372 |
|
|
373 |
0 |
ul = new UrlLink(links.get(2)); |
374 |
0 |
linkset = new LinkedHashMap<>(); |
375 |
0 |
ul.createLinksFromSeq(seq0, linkset); |
376 |
0 |
assertEquals(3, linkset.size()); |
377 |
|
|
378 |
|
|
379 |
0 |
key = "IPR001041|http://www.ebi.ac.uk/interpro/entry/IPR001041"; |
380 |
0 |
assertTrue(linkset.containsKey(key)); |
381 |
0 |
assertEquals("INTERPRO", linkset.get(key).get(0)); |
382 |
0 |
assertEquals("INTERPRO" + SEP + "IPR001041", linkset.get(key).get(1)); |
383 |
0 |
assertEquals("IPR001041", linkset.get(key).get(2)); |
384 |
0 |
assertEquals("http://www.ebi.ac.uk/interpro/entry/IPR001041", |
385 |
|
linkset.get(key).get(3)); |
386 |
|
|
387 |
0 |
key = "IPR006058|http://www.ebi.ac.uk/interpro/entry/IPR006058"; |
388 |
0 |
assertTrue(linkset.containsKey(key)); |
389 |
0 |
assertEquals("INTERPRO", linkset.get(key).get(0)); |
390 |
0 |
assertEquals("INTERPRO" + SEP + "IPR006058", linkset.get(key).get(1)); |
391 |
0 |
assertEquals("IPR006058", linkset.get(key).get(2)); |
392 |
0 |
assertEquals("http://www.ebi.ac.uk/interpro/entry/IPR006058", |
393 |
|
linkset.get(key).get(3)); |
394 |
|
|
395 |
0 |
key = "IPR012675|http://www.ebi.ac.uk/interpro/entry/IPR012675"; |
396 |
0 |
assertTrue(linkset.containsKey(key)); |
397 |
0 |
assertEquals("INTERPRO", linkset.get(key).get(0)); |
398 |
0 |
assertEquals("INTERPRO" + SEP + "IPR012675", linkset.get(key).get(1)); |
399 |
0 |
assertEquals("IPR012675", linkset.get(key).get(2)); |
400 |
0 |
assertEquals("http://www.ebi.ac.uk/interpro/entry/IPR012675", |
401 |
|
linkset.get(key).get(3)); |
402 |
|
|
403 |
|
|
404 |
0 |
ul = new UrlLink(DB + SEP + URL_PREFIX + DELIM + DB_ACCESSION + DELIM |
405 |
|
+ URL_SUFFIX); |
406 |
0 |
linkset = new LinkedHashMap<>(); |
407 |
0 |
ul.createLinksFromSeq(seq0, linkset); |
408 |
0 |
assertTrue(linkset.isEmpty()); |
409 |
|
} |
410 |
|
|
411 |
|
|
412 |
|
|
413 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 1 |
Complexity Density: 0.1 |
4-
|
|
414 |
0 |
@Test(groups = { "Functional" })... |
415 |
|
public void testLinksWithTargets() |
416 |
|
{ |
417 |
0 |
UrlLink ul = new UrlLink( |
418 |
|
"Protein Data Bank | http://www.identifiers.org/pdb/$" |
419 |
|
+ DB_ACCESSION + "$" + " | pdb"); |
420 |
|
|
421 |
0 |
assertEquals("Protein Data Bank", ul.getLabel()); |
422 |
0 |
assertEquals("pdb", ul.getTarget()); |
423 |
0 |
assertEquals("http://www.identifiers.org/pdb/$" + DB_ACCESSION + "$", |
424 |
|
ul.getUrlWithToken()); |
425 |
|
|
426 |
0 |
assertEquals("Protein Data Bank|http://www.identifiers.org/pdb/$" |
427 |
|
+ DB_ACCESSION + "$" + "|pdb", ul.toStringWithTarget()); |
428 |
|
|
429 |
0 |
ul = new UrlLink("Protein Data Bank", |
430 |
|
"http://www.identifiers.org/pdb/$" + DB_ACCESSION + "$", "pdb"); |
431 |
|
|
432 |
0 |
assertEquals("Protein Data Bank", ul.getLabel()); |
433 |
0 |
assertEquals("pdb", ul.getTarget()); |
434 |
0 |
assertEquals("http://www.identifiers.org/pdb/$" + DB_ACCESSION + "$", |
435 |
|
ul.getUrlWithToken()); |
436 |
|
|
437 |
0 |
assertEquals("Protein Data Bank|http://www.identifiers.org/pdb/$" |
438 |
|
+ DB_ACCESSION + "$" + "|pdb", ul.toStringWithTarget()); |
439 |
|
|
440 |
|
} |
441 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 1 |
Complexity Density: 0.08 |
4-
|
|
442 |
0 |
@Test(groups = { "Functional" })... |
443 |
|
public void testLinkComparator() |
444 |
|
{ |
445 |
0 |
Comparator<String> c = UrlLink.LINK_COMPARATOR; |
446 |
0 |
assertEquals(0, c.compare(null, null)); |
447 |
0 |
assertEquals(0, c.compare(null, "x")); |
448 |
0 |
assertEquals(0, c.compare("y", null)); |
449 |
|
|
450 |
|
|
451 |
|
|
452 |
|
|
453 |
0 |
String dbRefUrl = "Cath|http://www.cathdb.info/version/v4_2_0/superfamily/$DB_ACCESSION$"; |
454 |
0 |
String seqIdUrl = "EBI|https://www.ebi.ac.uk/ebisearch/search.ebi?db=allebi&query=$SEQUENCE_ID$"; |
455 |
0 |
assertTrue(c.compare(seqIdUrl, dbRefUrl) < 0); |
456 |
0 |
assertTrue(c.compare(dbRefUrl, seqIdUrl) > 0); |
457 |
|
|
458 |
0 |
String interpro = "Interpro|https://www.ebi.ac.uk/interpro/entry/$DB_ACCESSION$"; |
459 |
0 |
String prosite = "ProSite|https://prosite.expasy.org/PS00197"; |
460 |
0 |
assertTrue(c.compare(interpro, prosite) < 0); |
461 |
0 |
assertTrue(c.compare(prosite, interpro) > 0); |
462 |
|
} |
463 |
|
} |