App implements Parcelable, Comparable<App> { @Override public int compareTo(App app) { return title.compareTo(app.title); } App(String title); private  App(Parcel in); boolean matches(String filter); @Override int compareTo(App app); @Override boolean equals(Object o); @Override int hashCode(); @Override int describeContents(); @Override void writeToParcel(Parcel dest, int flags); final String title; static final Creator<App> CREATOR; }
@Test public void should_compare_less() { App app = new App("AAA"); int result = app.compareTo(new App("BBB")); assertThat(result).isEqualTo(-1); }
@Test public void should_compare_greater() { App app = new App("BBB"); int result = app.compareTo(new App("AAA")); assertThat(result).isEqualTo(1); }
@Test public void should_compare_same() { App app = new App("AAA"); int result = app.compareTo(new App("AAA")); assertThat(result).isEqualTo(0); }