Code example for TextView

Methods: addTextChangedListenersetText

0
  } 
 
  @Test 
  public void whenSettingText_ShouldFireAfterTextChangedWithCorrectArgument() { 
    MockTextWatcher mockTextWatcher = new MockTextWatcher();
    textView.addTextChangedListener(mockTextWatcher);
 
    textView.setText(NEW_TEXT);
 
    assertThat(mockTextWatcher.afterTextChangeArgument.toString()).isEqualTo(NEW_TEXT);
  } 
 
  @Test 
  public void whenAppendingText_ShouldAppendNewTextAfterOldOne() { 
    textView.setText(INITIAL_TEXT);
    textView.append(NEW_TEXT);
 
    assertThat(textView.getText().toString()).isEqualTo(INITIAL_TEXT + NEW_TEXT);
  } 
 
  @Test