jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • FEST
  • FEST-389

ObjectAssert.isSameAs mixes up actual and expected in failure message when run inside IntelliJ IDEA

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Cannot Reproduce
  • Affects Version/s: FEST-Assert 1.3
  • Fix Version/s: FEST-Assert 1.3
  • Component/s: Assert
  • Labels:
    None
  • Environment:
    Fedora Core 12; Linux x86_64; TestNG 5.14; Sun Java 1.6.0_20, IntelliJ IDEA 9.0.3
  • Testcase included:
    yes

Description

When failing, ObjectAssert.isSameAs mixes up actual and expected in the error message.

How to reproduce:

@Test
public class AssertThatTest {

  public void testActualAndExpectedForObjects() {
    Object actual = new String("ACTUAL");
    Object expected = new String("EXPECTED");
    assertThat(actual).isSameAs(expected);
  }
  
  public void testActualAndExpectedForStrings() {
    assertThat("actual").isEqualTo("expected");
  }
}

Output:

java.lang.AssertionError: 
Expected :'ACTUAL'
Actual   :'EXPECTED'

	at org.fest.assertions.Fail.failure(Fail.java:228)
	at org.fest.assertions.Fail.fail(Fail.java:167)
	at org.fest.assertions.Fail.failIfNotSame(Fail.java:162)
	at org.fest.assertions.GenericAssert.assertSameAs(GenericAssert.java:297)
	at org.fest.assertions.**ObjectAssert**.isSameAs(ObjectAssert.java:186)
	at de.lightful.testng.experimental.AssertThatTest.testActualAndExpectedForObjects(AssertThatTest.java:29)

===============================================

java.lang.AssertionError: 
Expected :'expected'
Actual   :'actual'

	at org.fest.assertions.Fail.failure(Fail.java:228)
	at org.fest.assertions.Fail.comparisonFailed(Fail.java:85)
	at org.fest.assertions.Fail.failIfNotEqual(Fail.java:71)
	at org.fest.assertions.GenericAssert.assertEqualTo(GenericAssert.java:271)
	at org.fest.assertions.**StringAssert**.isEqualTo(StringAssert.java:128)
	at de.lightful.testng.experimental.AssertThatTest.testActualAndExpectedForStrings(AssertThatTest.java:33)

This means: StringAssert works correctly, ObjectAssert mixes up expected and actual values.

However, when run from the command line (mvn clean test -Dtest=AssertThatTest), the report contains only a generic message that two instances differ, without tagging any of them as either actual or expected (see attached html report).

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. HTML File
    emailable-report.html
    01/Sep/10 2:33 PM
    4 kB
    Ansgar Konermann
  1. IDEA-screenshot.png
    74 kB
    01/Sep/10 2:30 PM

Activity

  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Ansgar Konermann added a comment - 05/Jan/11 7:25 PM

Could not reproduce in IDEA 10.0.1, so it's obviously fixed / not reproducible with this version.

Show
Ansgar Konermann added a comment - 05/Jan/11 7:25 PM Could not reproduce in IDEA 10.0.1, so it's obviously fixed / not reproducible with this version.

People

  • Assignee:
    Ansgar Konermann
    Reporter:
    Ansgar Konermann
Vote (0)
Watch (0)

Dates

  • Created:
    01/Sep/10 2:24 PM
    Updated:
    05/Jan/11 7:25 PM
    Resolved:
    05/Jan/11 7:25 PM

Time Tracking

Estimated:
3h
Original Estimate - 3 hours
Remaining:
3h
Remaining Estimate - 3 hours
Logged:
Not Specified
Time Spent - Not Specified
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.