Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
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).
Could not reproduce in IDEA 10.0.1, so it's obviously fixed / not reproducible with this version.