TsMoniker implements Comparable<TsMoniker> { @Override public int compareTo(TsMoniker o) { if (this.uuid != null) { if (o.uuid != null) { return this.uuid.compareTo(o.uuid); } else { return -1; } } else if (o.uuid != null) { return 1; } else { int r0 = this.m_source.compareTo(o.m_source); return r0 != 0 ? r0 : this.m_id.compareTo(o.m_id); } } private  TsMoniker(String m_source, String m_id, UUID uuid); @Deprecated  TsMoniker();  TsMoniker(@NonNull String source, @NonNull String id); @NonNull static TsMoniker create(@Nullable String source, @Nullable String id); @NonNull static TsMoniker createAnonymousMoniker(); @NonNull static TsMoniker createDynamicMoniker(); @NonNull static TsMoniker createProvidedMoniker(@NonNull String source, @NonNull String id); @Nullable String getId(); @Nullable String getSource(); @NonNull Type getType(); @Deprecated boolean isAnonymous(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); @Override int compareTo(TsMoniker o);  }
@Test public void testCompareTo() { TsMoniker p1 = TsMoniker.createProvidedMoniker("A", "123"); TsMoniker p2 = TsMoniker.createProvidedMoniker("B", "123"); TsMoniker p3 = TsMoniker.createProvidedMoniker("C", "123"); assertThat(p1).isEqualByComparingTo(TsMoniker.createProvidedMoniker("A", "123")); assertThat(p2).isGreaterThan(p1); assertThat(p3).isGreaterThan(p2); assertThat(p3).isGreaterThan(p1); TsMoniker a1 = TsMoniker.createAnonymousMoniker(); TsMoniker a2 = TsMoniker.createAnonymousMoniker(); assertThat(a1).isEqualByComparingTo(a1); assertThat(a1.compareTo(a2)).isEqualTo(a2.compareTo(a1) * -1); }