Skip to content

Instantly share code, notes, and snippets.

@tarot
Last active October 26, 2017 08:48

Revisions

  1. tarot revised this gist Oct 26, 2017. 1 changed file with 5 additions and 2 deletions.
    7 changes: 5 additions & 2 deletions executeAnonymous.cls
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,8 @@
    Object a = ' ';
    Object b = '\u3000'; // 全角スペース
    Object a = '';
    Object b = '';

    System.assertEquals(true, a == b); // ←わかる
    System.assertEquals(false, a.equals(b)); // => Assertion Failed ←は?

    // Solution
    System.assertEquals(false, ((String) a).equals(b));
  2. tarot created this gist Oct 26, 2017.
    5 changes: 5 additions & 0 deletions executeAnonymous.cls
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    Object a = ' ';
    Object b = '\u3000'; // 全角スペース

    System.assertEquals(true, a == b); // ←わかる
    System.assertEquals(false, a.equals(b)); // => Assertion Failed ←は?