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

Improve error message for androidx.test.espresso.contrib.ActivityResultMatchers#hasResultCode

Open barney2k7 opened this issue 2 years ago • 0 comments

If there's a mismatch with ActivityResultMatchers#hasResultCode, you currently get an error message like this one, not showing the actual value:

java.lang.AssertionError:
Expected: has result code -1
but: was <android.app.Instrumentation$ActivityResult@af47c58>
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)

Please override describeMismatchSafely with something like mismatchDescription.appendText("result code was " + item.getResultCode());

barney2k7 avatar Dec 18 '23 08:12 barney2k7