assertj-android
assertj-android copied to clipboard
AbstractTextViewAssert.hasText() leads to java.util.UnknownFormatConversionException if text contains "%"
Assuming that a text view contains the '%' character, calling
assertThat(textView).hasText("any text")
will throw java.util.UnknownFormatConversionException if the assertion fails (expected text is not actual text).
This is due to AssertionError.failureIfErrorMessageIsOverriden() calling MessageFormatter.instance().format().
The solution would be to escape '%' characters in the description to be formatted.
Nice find.
This seems like a bug in FEST, not this library specifically. It's attempting to do that format twice without proper escaping. I'll have to test with normal assertions to see if this happens.
Thank you Jake