Test CharSequences for equality in JUnit <p>The following test runs successfully:</p> <pre><code>assertEquals(a.toString(), b.toString()); </code></pre> <p>The following does not:</p> <pre><code>assertEquals(a, b); </code></pre> <p><code>a</code> is a <code>StringBuilder</code>, while <code>b</code> is a <code>CharSequence</code> of a different type.</p> <p>Is there some way to test <code>CharSequence</code>s for equality without converting them to <code>String</code>s first?</p>