@Test public void testSetsTextReplacement() { TextReplacementData data = mock(TextReplacementData.class); when(data.getId()).thenReturn("r42"); decorator.setTextReplacement(data); verify(text).setData(TEXT_REPLACEMENT.getKey(), "r42"); }
@Test public void testDoesNotSetTextReplacementWithWebClient() { environment.setClient(mock(WebClient.class)); TextReplacementData data = mock(TextReplacementData.class); when(data.getId()).thenReturn("r42"); decorator.setTextReplacement(data); verify(text, never()).setData(TEXT_REPLACEMENT.getKey(), "r42"); }
@Test public void testUseUrlKeyboard() { decorator.useUrlKeyboard(); verify(text).setData(KEYBOARD.getKey(), "url"); }
@Test public void testUseNumbersAndPunctuationKeyboard() { decorator.useNumbersAndPunctuationKeyboard(); verify(text).setData(KEYBOARD.getKey(), "numbersAndPunctuation"); }
@Test public void testUseAsciiKeyboard() { decorator.useAsciiKeyboard(); verify(text).setData(KEYBOARD.getKey(), "ascii"); }
@Test public void testUseHintText() { decorator.useHintText("test"); verify(text).setMessage(eq("test")); }
@Test public void testSetAutoCapitalizeDisabled() { decorator.setAutoCapitalizationEnabled(false); verify(text).setData(AUTO_CAPITALIZE.getKey(), Boolean.valueOf(false)); }
@Test public void testSetAutoCorrectDisabled() { decorator.setAutoCorrectionEnabled(false); verify(text).setData(AUTO_CORRECT.getKey(), Boolean.valueOf(false)); }
@Test(expected = IllegalArgumentException.class) public void testSetTextReplacementFailsWithNullData() { decorator.setTextReplacement(null); }
@Test public void testUsePhoneKeyboard() { decorator.usePhoneKeyboard(); verify(text).setData(KEYBOARD.getKey(), "phone"); }