### Question:
EmojiInputConnection extends InputConnectionWrapper { @Override public boolean deleteSurroundingTextInCodePoints(final int beforeLength, final int afterLength) { final boolean result = EmojiCompat.handleDeleteSurroundingText(this, getEditable(), beforeLength, afterLength, true ); return result || super.deleteSurroundingTextInCodePoints(beforeLength, afterLength); } EmojiInputConnection(
            @NonNull final TextView textView,
            @NonNull final InputConnection inputConnection,
            @NonNull final EditorInfo outAttrs); @Override boolean deleteSurroundingText(final int beforeLength, final int afterLength); @Override boolean deleteSurroundingTextInCodePoints(final int beforeLength,
            final int afterLength);  }### Answer:
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.N) @Test public void testDeleteSurroundingTextInCodePoints_doesNotDelete() { Selection.setSelection(mEditable, 0, mEditable.length()); assertFalse(mEmojiEmojiInputConnection.deleteSurroundingTextInCodePoints(1, 0)); verify(mInputConnection, times(1)).deleteSurroundingTextInCodePoints(1, 0); }
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.N) @Test public void testDeleteSurroundingTextInCodePoints_deletesEmojiBackward() { Selection.setSelection(mEditable, mTestString.emojiEndIndex()); assertTrue(mEmojiEmojiInputConnection.deleteSurroundingTextInCodePoints(1, 0)); verify(mInputConnection, never()).deleteSurroundingTextInCodePoints(anyInt(), anyInt()); }
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.N) @Test public void testDeleteSurroundingTextInCodePoints_deletesEmojiForward() { Selection.setSelection(mEditable, mTestString.emojiStartIndex()); assertTrue(mEmojiEmojiInputConnection.deleteSurroundingTextInCodePoints(0, 1)); verify(mInputConnection, never()).deleteSurroundingTextInCodePoints(anyInt(), anyInt()); }
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.N) @Test public void testDeleteSurroundingTextInCodePoints_doesNotDeleteEmojiIfSelectionAtStartIndex() { Selection.setSelection(mEditable, mTestString.emojiStartIndex()); assertFalse(mEmojiEmojiInputConnection.deleteSurroundingTextInCodePoints(1, 0)); verify(mInputConnection, times(1)).deleteSurroundingTextInCodePoints(1, 0); }