コード例 #1
0
  @Test
  public void testSetsTextReplacement() {
    TextReplacementData data = mock(TextReplacementData.class);
    when(data.getId()).thenReturn("r42");

    decorator.setTextReplacement(data);

    verify(text).setData(TEXT_REPLACEMENT.getKey(), "r42");
  }
コード例 #2
0
  @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");
  }
コード例 #3
0
 @Test(expected = IllegalArgumentException.class)
 public void testSetTextReplacementFailsWithNullData() {
   decorator.setTextReplacement(null);
 }