SelectOption implements Comparable<SelectOption> { @Override public int compareTo(SelectOption other) { return this.text.compareTo(other.text); } SelectOption(String value, String text); String getText(); String getValue(); @Override int hashCode(); @Override boolean equals(Object obj); @Override int compareTo(SelectOption other); @Override String toString();  }
@Test public void selectOptionsAreSortedByTextValue() { SelectOption firstOption = new SelectOption("99999", "AAAA"); SelectOption secondOption = new SelectOption("00000", "ZZZZZ"); assertThat(firstOption.compareTo(secondOption), lessThan(0)); }