@Test
    public void hint_isDisplayedInEditText() {
        String hintText = getApplicationContext().getResources().getString(R.string.hint);

        onView(withId(R.id.editText)).check(matches(HintMatcher.withHint(hintText)));
    }
Uses a custom matcher {@link HintMatcher#withHint}, with a {@link String} as the argument.
ui/espresso/CustomMatcherSample/app/src/sharedTest/java/com/example/android/testing/espresso/CustomMatcherSample/HintMatchersTest.java