/** * Uses the matcher SelectedValue to compare the text on a button to the expected text of the matcher, * using the syntax "text("xxx")" * * @param button the button * @return True if the text on the button is equal to the text of the matcher Text */ @Override public boolean matchesSafely(Button button) { return button.text().equals(text); }
/** * @see Component */ @Override public String toString() { return super.toString() + ", text:" + text() + ", icon:" + icon(); } }
@Test public void test_button_text() { Button button = new Button(evaluator, id); when(evaluator.text(button)).thenReturn("buttonText"); assertThat(button.text(), is("buttonText")); }