/** * Uses the matcher ContainsText to compare the content of a given textfield to the expected values of the matcher, * using the syntax "containsText("xxx")" or "containsExactlyText("xxx")" * * @param textField the textField * @return True if the textfield contains (contains exactly for second syntax) the values of the matcher ContainsText */ public boolean matchesSafely(TextField textField) { if (exactly) { return text.equals(textField.value()); } String patternStr = text; Pattern pattern = Pattern.compile(patternStr); java.util.regex.Matcher matcher = pattern.matcher(textField.value()); return matcher.find(); }