@Test public void equals_returns_false() throws Exception { SafeString a = new SafeString("this is a test"); SafeString b = new SafeString("this is another test"); assertFalse(a.equals(b)); assertFalse(b.equals(a)); assertFalse(a.equals(null)); assertFalse(a.equals(5)); assertFalse(a.equals("this is a test")); }
@Override public boolean equals(Object obj) { if (obj == null || !(obj instanceof SafeString)) { return false; } SafeString other = (SafeString) obj; return other.mString.equals(mString); }
SafeString implements CharSequence, Serializable { @Override public boolean equals(Object obj) { if (obj == null || !(obj instanceof SafeString)) { return false; } SafeString other = (SafeString) obj; return other.mString.equals(mString); } }
SafeString implements CharSequence, Serializable { @Override public boolean equals(Object obj) { if (obj == null || !(obj instanceof SafeString)) { return false; } SafeString other = (SafeString) obj; return other.mString.equals(mString); } SafeString(@NonNull String s); }
SafeString implements CharSequence, Serializable { @Override public boolean equals(Object obj) { if (obj == null || !(obj instanceof SafeString)) { return false; } SafeString other = (SafeString) obj; return other.mString.equals(mString); } SafeString(@NonNull String s); boolean isEmpty(); @Override int length(); @Override char charAt(int index); @Override CharSequence subSequence(int start, int end); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode(); }
SafeString implements CharSequence, Serializable { @Override public boolean equals(Object obj) { if (obj == null || !(obj instanceof SafeString)) { return false; } SafeString other = (SafeString) obj; return other.mString.equals(mString); } SafeString(@NonNull String s); boolean isEmpty(); @Override int length(); @Override char charAt(int index); @Override CharSequence subSequence(int start, int end); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode();  }