From 02228702dad2ec2a7559c4dbd60d2748542da583 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Mon, 25 Aug 2014 13:43:44 +0200 Subject: [PATCH] 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). --- .../java/org/jivesoftware/smack/util/XmlStringBuilder.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java b/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java index 888d7b839..c86eaa777 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java @@ -285,11 +285,11 @@ public class XmlStringBuilder implements Appendable, CharSequence { @Override public boolean equals(Object other) { - if (!(other instanceof XmlStringBuilder)) { + if (!(other instanceof CharSequence)) { return false; } - XmlStringBuilder otherXmlStringBuilder = (XmlStringBuilder) other; - return toString().equals(otherXmlStringBuilder.toString()); + CharSequence otherCharSequenceBuilder = (CharSequence) other; + return toString().equals(otherCharSequenceBuilder.toString()); } @Override