+ @Test(groups = { "Functional" })
+ public void testLinkComparator()
+ {
+ Comparator<String> c = UrlLink.LINK_COMPARATOR;
+ assertEquals(0, c.compare(null, null));
+ assertEquals(0, c.compare(null, "x"));
+ assertEquals(0, c.compare("y", null));
+
+ /*
+ * SEQUENCE_ID templates should come before DB_ACCESSION templates
+ */
+ String dbRefUrl = "Cath|http://www.cathdb.info/version/v4_2_0/superfamily/$DB_ACCESSION$";
+ String seqIdUrl = "EBI|https://www.ebi.ac.uk/ebisearch/search.ebi?db=allebi&query=$SEQUENCE_ID$";
+ assertTrue(c.compare(seqIdUrl, dbRefUrl) < 0);
+ assertTrue(c.compare(dbRefUrl, seqIdUrl) > 0);
+
+ String interpro = "Interpro|https://www.ebi.ac.uk/interpro/entry/$DB_ACCESSION$";
+ String prosite = "ProSite|https://prosite.expasy.org/PS00197";
+ assertTrue(c.compare(interpro, prosite) < 0);
+ assertTrue(c.compare(prosite, interpro) > 0);
+ }