Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

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

Open
#2,064 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
50/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
android, java
Domain
mobile, testing

Research direction

Open espresso/contrib/java/androidx/test/espresso/contrib/ActivityResultMatchers.java and start at ActivityResultMatchers#hasResultCode. Confirm how the mismatch is currently described and make the failure report the actual result code instead of the ActivityResult object. Done means a mismatch shows the returned result code.

Written by the indexing model from the issue text.

Description

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());

Dominant language
Java
Stars
1.2k
Forks
342
Avg merge
1d 14h
Merged PRs (30d)
5

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from android/android-test

All issues in android/android-test

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.