Espresso Custom ViewMatcher Mismatch description not appearing in the log


I have written the following view matcher for my custom view

    public static Matcher<View> withValue(final Matcher<Long> longMatcher){
    return new BoundedMatcher<View, IntegerField>(IntegerField.class) {

        public void describeTo(Description description) {
            description.appendText("with value : ");

        public void describeMismatch(Object item, Description description) {
            super.describeMismatch(item, description);
            description.appendText("value=" + ((IntegerField)item).getValue());

        protected boolean matchesSafely(IntegerField field) {
            return longMatcher.matches(field.getValue());

when the match fails, the log doesn't contain the mismatch description I appended in the descibeMismatch() function. Is there anything that I missed?

By : manidesto

This video can help you solving your question :)
By: admin