assertj-android icon indicating copy to clipboard operation
assertj-android copied to clipboard

honor .as() method on asserts

Open yogurtearl opened this issue 11 years ago • 1 comments

Update various asserts to honor descriptions passed to "as".

E.g.

assertThat(fooView).as("Foo").isGone()

would print:

Expected Foo to be gone but was visible

For example isGone would contain would be roughly ( based on your current code ):

assertThat(actualVisibility) 
        .overridingErrorMessage("Expected " +
        getWritableAssertionInfo().getDescriptionText() 
             + " to be gone but was %s",
            visibilityToString(actualVisibility)) 
        .isEqualTo(GONE);

Reference:

https://github.com/alexruiz/fest-assert-2.x/blob/fest-assert-core-2.0M10/src/main/java/org/fest/assertions/api/AbstractAssert.java

https://github.com/alexruiz/fest-assert-2.x/blob/fest-assert-core-2.0M10/src/main/java/org/fest/assertions/core/WritableAssertionInfo.java

yogurtearl avatar Nov 13 '13 22:11 yogurtearl

:thumbsup: Going to be a lot of manual work... we have a lot of assertions!

JakeWharton avatar Nov 18 '13 08:11 JakeWharton