Fixed
Status Update
Comments
nk...@google.com <nk...@google.com> #2
Thanks for reporting this issue. We will look into it before next release.
Meanwhile consider contributing the fix yourself, here is how:
https://google.github.io/android-testing-support-library/contribute/index.html
Meanwhile consider contributing the fix yourself, here is how:
nk...@google.com <nk...@google.com>
nk...@google.com <nk...@google.com> #3
This is fixed in the next Espresso v3.0 release.
Description
I tried making a test case to verify that an error state has disappeared from an edittext, and noticed that the implementation of hasErrorText unconditionally dereferences view.getError(), which makes it impossible to use it to test against against the absence of an error state.
is it possible to update the code to support checks against null? For instance, the following one-line change in ViewMatchers.java should allow a nullValue matcher:
- return stringMatcher.matches(view.getError().toString());
+ return stringMatcher.matches((view.getError() != null) ? view.getError().toString() : null);
In addition, it seems that the documentation for withHint explicitly indicates that null is an option, whereas that mention is absent for getErrorText even though the situation exists in practice.