### Question:
EmojiInputConnection extends InputConnectionWrapper { @Override public boolean deleteSurroundingText(final int beforeLength, final int afterLength) { final boolean result = EmojiCompat.handleDeleteSurroundingText(this, getEditable(), beforeLength, afterLength, false ); return result || super.deleteSurroundingText(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:
@Test public void testDeleteSurroundingText_doesNotDelete() { Selection.setSelection(mEditable, 0, mEditable.length()); assertFalse(mEmojiEmojiInputConnection.deleteSurroundingText(1, 0)); verify(mInputConnection, times(1)).deleteSurroundingText(1, 0); }
@Test public void testDeleteSurroundingText_deletesEmojiBackward() { Selection.setSelection(mEditable, mTestString.emojiEndIndex()); assertTrue(mEmojiEmojiInputConnection.deleteSurroundingText(1, 0)); verify(mInputConnection, never()).deleteSurroundingText(anyInt(), anyInt()); }
@Test public void testDeleteSurroundingText_doesNotDeleteEmojiIfSelectionAtStartIndex() { Selection.setSelection(mEditable, mTestString.emojiStartIndex()); assertFalse(mEmojiEmojiInputConnection.deleteSurroundingText(1, 0)); verify(mInputConnection, times(1)).deleteSurroundingText(1, 0); }
@Test public void testDeleteSurroundingText_deletesEmojiForward() { Selection.setSelection(mEditable, mTestString.emojiStartIndex()); assertTrue(mEmojiEmojiInputConnection.deleteSurroundingText(0, 1)); verify(mInputConnection, never()).deleteSurroundingText(anyInt(), anyInt()); }