@Test public void testCompareWithOneTopLanguage2() { Language l1 = new Language(); Language l2 = new Language(); l1.setId("rus"); l2.setId("fra"); LanguageComparator comp = new LanguageComparator("fra"); int actual = comp.compare(l1, l2); Assert.assertEquals(-1, actual); }
@Override public int compare(Language o1, Language o2) { if (o1.getId().equals(defaultLanguage)) { if (o2.getId().equals(defaultLanguage)) { return 0; } else { return 1; } } else if (o2.getId().equals(defaultLanguage)) { return -1; } else { return o2.getRefname().compareTo(o1.getRefname()); } }
LanguageComparator implements Comparator<Language> { @Override public int compare(Language o1, Language o2) { if (o1.getId().equals(defaultLanguage)) { if (o2.getId().equals(defaultLanguage)) { return 0; } else { return 1; } } else if (o2.getId().equals(defaultLanguage)) { return -1; } else { return o2.getRefname().compareTo(o1.getRefname()); } } }
LanguageComparator implements Comparator<Language> { @Override public int compare(Language o1, Language o2) { if (o1.getId().equals(defaultLanguage)) { if (o2.getId().equals(defaultLanguage)) { return 0; } else { return 1; } } else if (o2.getId().equals(defaultLanguage)) { return -1; } else { return o2.getRefname().compareTo(o1.getRefname()); } } LanguageComparator(String defaultLanguage); }
LanguageComparator implements Comparator<Language> { @Override public int compare(Language o1, Language o2) { if (o1.getId().equals(defaultLanguage)) { if (o2.getId().equals(defaultLanguage)) { return 0; } else { return 1; } } else if (o2.getId().equals(defaultLanguage)) { return -1; } else { return o2.getRefname().compareTo(o1.getRefname()); } } LanguageComparator(String defaultLanguage); @Override int compare(Language o1, Language o2); }
LanguageComparator implements Comparator<Language> { @Override public int compare(Language o1, Language o2) { if (o1.getId().equals(defaultLanguage)) { if (o2.getId().equals(defaultLanguage)) { return 0; } else { return 1; } } else if (o2.getId().equals(defaultLanguage)) { return -1; } else { return o2.getRefname().compareTo(o1.getRefname()); } } LanguageComparator(String defaultLanguage); @Override int compare(Language o1, Language o2);  }