mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-22 22:32:06 +01:00
Make XmlStringBuilder equals() CharSequence aware
The minimal condition in order to check equality in XmlStringBuilder is that 'other' implements the CharSequence interface. Not as it was previously, that it's also a XmlStringBuilder. This allows junit's assertEquals() to be used (to a certain extend).
This commit is contained in:
parent
f282323eec
commit
02228702da
1 changed files with 3 additions and 3 deletions
|
@ -285,11 +285,11 @@ public class XmlStringBuilder implements Appendable, CharSequence {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object other) {
|
public boolean equals(Object other) {
|
||||||
if (!(other instanceof XmlStringBuilder)) {
|
if (!(other instanceof CharSequence)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
XmlStringBuilder otherXmlStringBuilder = (XmlStringBuilder) other;
|
CharSequence otherCharSequenceBuilder = (CharSequence) other;
|
||||||
return toString().equals(otherXmlStringBuilder.toString());
|
return toString().equals(otherCharSequenceBuilder.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue