@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(expected = IllegalArgumentException.class) public void testSetTextReplacementFailsWithNullData() { decorator.setTextReplacement(null); }