SpacedEditText extends TextInputEditText { @Override public void setText(CharSequence text, BufferType type) { mOriginalText = new SpannableStringBuilder(text); super.setText(getSpacedOutString(text), BufferType.SPANNABLE); } SpacedEditText(Context context);  SpacedEditText(Context context, AttributeSet attrs); @Override void setText(CharSequence text, BufferType type); @Override void setSelection(int index); Editable getUnspacedText();  }
@Test public void testSpacedEditText_setTextWithOneCharacter() { mSpacedEditText.setText("1"); testSpacing("1", "1", mSpacedEditText); }
@Test public void testSpacedEditText_setTextWithExistingSpaces() { mSpacedEditText.setText("1 2 3"); testSpacing("1 2 3", "1 2 3", mSpacedEditText); }
@Test public void testSpacedEditText_setTextEmpty() { mSpacedEditText.setText(""); testSpacing("", "", mSpacedEditText); }
@Test public void testSpacedEditText_setTextNonEmpty() { mSpacedEditText.setText("123456"); testSpacing("1 2 3 4 5 6", "123456", mSpacedEditText); }