assertEquals(1, compareBothRegularAndRaw(comp, k4, k1));
assertEquals(1, compareBothRegularAndRaw(comp, k5, k1));
}
public void testUrlScoreSorting() throws IOException {
UrlScoreComparator comp = new UrlScoreComparator();
UrlWithScore k1 = new UrlWithScore("http://example.org/1", 1f);
UrlWithScore k2 = new UrlWithScore("http://example.org/1", 2f);
UrlWithScore k3 = new UrlWithScore("http://example.org/2", 1f);
UrlWithScore k4 = new UrlWithScore("http://example.org/2", 2f);
UrlWithScore k5 = new UrlWithScore("http://example.org/2", 3f);
// k1 is after k2, because score is lower
assertEquals(1, comp.compare(k1, k2));
// test symmetry
assertEquals(-1, comp.compare(k2, k1));
// k1 is before k3, k4 and k5, because url is lower
assertEquals(-1, compareBothRegularAndRaw(comp, k1, k3));
assertEquals(-1, compareBothRegularAndRaw(comp, k1, k4));
assertEquals(-1, compareBothRegularAndRaw(comp, k1, k5));