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