545556575859606162
when(element.isEnabled()).thenReturn(false); return element; } public static TextInput mockTextInput(String enteredText) { TextInput textInput = mock(TextInput.class); when(textInput.getText()).thenReturn(enteredText); return textInput; }
1415161718192021
public class HasEnteredTextTest { private static final String ENTERED_TEXT = "some text"; @Test public void hasEnteredTextTest() { TextInput textInput = MockFactory.mockTextInput(ENTERED_TEXT); assertThat(textInput, hasEnteredText(ENTERED_TEXT)); }