### Question:
EmojiEditTextHelper { @Nullable public InputConnection onCreateInputConnection(@Nullable final InputConnection inputConnection, @NonNull final EditorInfo outAttrs) { if (inputConnection == null) return null; return mHelper.onCreateInputConnection(inputConnection, outAttrs); } EmojiEditTextHelper(@NonNull final EditText editText); void setMaxEmojiCount(@IntRange(from = 0) int maxEmojiCount); int getMaxEmojiCount(); @NonNull KeyListener getKeyListener(@NonNull final KeyListener keyListener); @Nullable InputConnection onCreateInputConnection(@Nullable final InputConnection inputConnection,
            @NonNull final EditorInfo outAttrs);  }### Answer:
@Test public void testGetOnCreateInputConnection_withNullAttrs_returnsInputConnection() { final InputConnection inputConnection = mEmojiEditTextHelper.onCreateInputConnection( mock(InputConnection.class), null); assertNotNull(inputConnection); assertThat(inputConnection, instanceOf(EmojiInputConnection.class)); }
@Test public void testGetOnCreateInputConnection_withNullInputConnection_returnsNull() { InputConnection inputConnection = mEmojiEditTextHelper.onCreateInputConnection(null, new EditorInfo()); assertNull(inputConnection); }
@Test public void testGetOnCreateInputConnection_returnsEmojiInputConnection() { final InputConnection inputConnection = mEmojiEditTextHelper.onCreateInputConnection( mock(InputConnection.class), null); assertNotNull(inputConnection); assertThat(inputConnection, instanceOf(EmojiInputConnection.class)); }
@Test public void testGetOnCreateInputConnection_doesNotCreateNewInstance() { final InputConnection ic1 = mEmojiEditTextHelper.onCreateInputConnection( mock(InputConnection.class), null); final InputConnection ic2 = mEmojiEditTextHelper.onCreateInputConnection(ic1, null); assertSame(ic1, ic2); }