private static boolean validateText(String inputText) {
        // Every input ending in VALID_ENDING will return true.
        if (inputText.toLowerCase().endsWith(VALID_ENDING)) {
            return true;
        }

        // Check if the string is in the list.
        for (String preparation : COFFEE_PREPARATIONS) {
            if (preparation.equalsIgnoreCase(inputText)) {
                return true;
            }
        }
        return false;
    }
Asks the user for a coffee preparation and shows if it is valid.
<p>Valid inputs are anything ending in "coffee" or strings listed in
{@link MainActivity#COFFEE_PREPARATIONS} The check is always case-insensitive.
</p>
ui/espresso/CustomMatcherSample/app/src/main/java/com/example/android/testing/espresso/CustomMatcherSample/MainActivity.java