FEST
  1. FEST
  2. FEST-242

nicer debugging output with jUnit's ComparisonFailure

    Details

    • Type: Improvement Improvement
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: FEST-Assert 1.1
    • Fix Version/s: FEST-Assert 1.2
    • Component/s: Assert
    • Labels:
      None
    • Number of attachments :
      0

      Description

      FEST currently uses ComparisonFailure when doing isEqualTo with Strings. ComparisonFailure has some extra benefits in modern IDEs, e.g. Eclipse offers extra pop-up info with detailed comparison highlighting the differences.

      I propose to use this exception for isEqualTo on other types as well. It could work like this:

      1. assertThat(foo).isEqualTo(foo2);
      2. if the assertion fails
        1. if the foo.toString() is not equal to foo2.toString() then throw new ComparisonFailure(foo.toString(), foo2.toString())
        2. if the foo.toString() is equal to foo2.toString() then DON'T throw ComparisonFailure because it is confusing
      3. assertion doesn't fail. Good for you.

      This is a proposal and if you guys think it is useful the please stick it into November release. I think it is useful because on the occasion I remember I temporarily refactored assertions into assertEquals(expected.toString(), actual.toString()) just to have nicer message

        Activity

        Hide
        Alex Ruiz added a comment -

        I fixed this issue some time ago, but I forgot to create an issue for it.

        Show
        Alex Ruiz added a comment - I fixed this issue some time ago, but I forgot to create an issue for it.

          People

          • Assignee:
            Alex Ruiz
            Reporter:
            Szczepan Faber
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: