Code example for SpannableStringBuilder

0
  @Test 
  public void whenSettingTextToNull_WatchersSeeEmptyString() { 
    TextWatcher mockTextWatcher = mock(TextWatcher.class);
    textView.addTextChangedListener(mockTextWatcher);
    textView.setText(null);
    verify(mockTextWatcher).onTextChanged(new SpannableStringBuilder(""), 0, 0, 0);
  } 
 
  @Test 
  public void getPaint_returnsNonNull() { 
    assertNotNull(textView.getPaint());
  } 
 
  @Test 
  public void testNoArgAppend() { 
    textView.setText("a");
    textView.append("b");
    assertThat(textView.getText().toString()).isEqualTo("ab");
  } 
 
  @Test