### Question:
EmojiEditTextHelper { @NonNull public KeyListener getKeyListener(@NonNull final KeyListener keyListener) { Preconditions.checkNotNull(keyListener, "keyListener cannot be null"); return mHelper.getKeyListener(keyListener); } 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(expected = NullPointerException.class) public void testGetKeyListener_withNull_throwsException() { mEmojiEditTextHelper.getKeyListener(null); }
@Test public void testGetKeyListener_returnsEmojiKeyListener() { final KeyListener keyListener = mEmojiEditTextHelper.getKeyListener( mock(KeyListener.class)); assertThat(keyListener, instanceOf(EmojiKeyListener.class)); }
@Test public void testGetKeyListener_doesNotCreateNewInstance() { KeyListener mockKeyListener = mock(KeyListener.class); final KeyListener keyListener1 = mEmojiEditTextHelper.getKeyListener(mockKeyListener); final KeyListener keyListener2 = mEmojiEditTextHelper.getKeyListener(keyListener1); assertSame(keyListener1, keyListener2); }