### Question:
EmojiEditText extends EditText { public void setMaxEmojiCount(@IntRange(from = 0) int maxEmojiCount) { getEmojiEditTextHelper().setMaxEmojiCount(maxEmojiCount); } EmojiEditText(Context context);  EmojiEditText(Context context, AttributeSet attrs);  EmojiEditText(Context context, AttributeSet attrs, int defStyleAttr); @RequiresApi(Build.VERSION_CODES.LOLLIPOP)  EmojiEditText(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes); @Override void setKeyListener(@Nullable KeyListener keyListener); @Override InputConnection onCreateInputConnection(EditorInfo outAttrs); void setMaxEmojiCount(@IntRange(from = 0) int maxEmojiCount); int getMaxEmojiCount();  }### Answer:
@Test @SdkSuppress(minSdkVersion = 19) public void testSetMaxCount() { final TestActivity activity = mActivityRule.getActivity(); final EmojiEditText editText = activity.findViewById(R.id.editTextWithMaxCount); mInstrumentation.runOnMainSync(new Runnable() { @Override public void run() { editText.setMaxEmojiCount(1); final String string = new TestString(EMOJI_SINGLE_CODEPOINT).append( EMOJI_SINGLE_CODEPOINT).toString(); editText.setText(string); } }); mInstrumentation.waitForIdleSync(); assertThat(editText.getText(), hasEmojiCount(1)); }