If I understand correctly, the basic principle of catching error catching is that when a certain expected error occurs, return the result of true / false value or the result of the value itself.
I have a certain expression (test) that checks the text in specific IDs, and the task is that if the text does not match (was different from what I expected), I would catch the error by try / catch .
The question itself is how to correctly put this expression in a try / catch so that if one of the parameters does not match, the error is “caught”:
private val isDialogRunning: Boolean get() { onView(Matchers.allOf(withId(R.id.titleTextView), ViewMatchers.withText("Warning"))) .check(ViewAssertions.matches(isDisplayed())) return true } - How to determine the error itself? Well, that is, I approximately know what error will take off if there is incorrect data, but how will it be correct to register it in catch?