ChangeScript implements Comparable { public int compareTo(Object o) { ChangeScript other = (ChangeScript) o; return Long.valueOf(this.id).compareTo(other.id); } ChangeScript(long id);  ChangeScript(long id, String description);  ChangeScript(long id, File file, String encoding); File getFile(); long getId(); String getDescription(); int compareTo(Object o); @Override String toString(); String getContent(); String getUndoContent();  }
@Test public void changeScriptsNaturallyOrderById() throws Exception { ChangeScript one = new ChangeScript(1); ChangeScript two = new ChangeScript(2); assertThat(one.compareTo(two), lessThan(1)); assertThat(two.compareTo(one), greaterThanOrEqualTo(1)); }