@Test public void testCompareTo_DifferentCase_LDAP259() { LdapRdnComponent component1 = new LdapRdnComponent("cn", "john doe"); LdapRdnComponent component2 = new LdapRdnComponent("CN", "John Doe"); assertThat(component2).as("Should be equal").isEqualTo(component1); assertThat(component1.compareTo(component2) == 0).as("0 should be returned by compareTo").isTrue(); }
public int compareTo(Object obj) { LdapRdnComponent that = (LdapRdnComponent) obj; int keyCompare = this.key.toLowerCase().compareTo(that.key.toLowerCase()); if(keyCompare == 0) { return this.value.toLowerCase().compareTo(that.value.toLowerCase()); } else { return keyCompare; } }
LdapRdnComponent implements Comparable, Serializable { public int compareTo(Object obj) { LdapRdnComponent that = (LdapRdnComponent) obj; int keyCompare = this.key.toLowerCase().compareTo(that.key.toLowerCase()); if(keyCompare == 0) { return this.value.toLowerCase().compareTo(that.value.toLowerCase()); } else { return keyCompare; } } }
LdapRdnComponent implements Comparable, Serializable { public int compareTo(Object obj) { LdapRdnComponent that = (LdapRdnComponent) obj; int keyCompare = this.key.toLowerCase().compareTo(that.key.toLowerCase()); if(keyCompare == 0) { return this.value.toLowerCase().compareTo(that.value.toLowerCase()); } else { return keyCompare; } } LdapRdnComponent(String key, String value);  LdapRdnComponent(String key, String value, boolean decodeValue); }
LdapRdnComponent implements Comparable, Serializable { public int compareTo(Object obj) { LdapRdnComponent that = (LdapRdnComponent) obj; int keyCompare = this.key.toLowerCase().compareTo(that.key.toLowerCase()); if(keyCompare == 0) { return this.value.toLowerCase().compareTo(that.value.toLowerCase()); } else { return keyCompare; } } LdapRdnComponent(String key, String value);  LdapRdnComponent(String key, String value, boolean decodeValue); String getKey(); void setKey(String key); String getValue(); void setValue(String value); String toString(); String getLdapEncoded(); String encodeUrl(); int hashCode(); boolean equals(Object obj); int compareTo(Object obj); LdapRdnComponent immutableLdapRdnComponent(); }
LdapRdnComponent implements Comparable, Serializable { public int compareTo(Object obj) { LdapRdnComponent that = (LdapRdnComponent) obj; int keyCompare = this.key.toLowerCase().compareTo(that.key.toLowerCase()); if(keyCompare == 0) { return this.value.toLowerCase().compareTo(that.value.toLowerCase()); } else { return keyCompare; } } LdapRdnComponent(String key, String value);  LdapRdnComponent(String key, String value, boolean decodeValue); String getKey(); void setKey(String key); String getValue(); void setValue(String value); String toString(); String getLdapEncoded(); String encodeUrl(); int hashCode(); boolean equals(Object obj); int compareTo(Object obj); LdapRdnComponent immutableLdapRdnComponent(); static final boolean DONT_DECODE_VALUE; }