Emoji implements Serializable { @NonNull public Emoji getBase() { Emoji result = this; while (result.base != null) { result = result.base; } return result; } Emoji(@NonNull final int[] codePoints, @NonNull final String[] shortcodes,
               @DrawableRes final int resource, final boolean isDuplicate);  Emoji(final int codePoint, @NonNull final String[] shortcodes,
               @DrawableRes final int resource, final boolean isDuplicate);  Emoji(final int codePoint, @NonNull final String[] shortcodes,
               @DrawableRes final int resource, final boolean isDuplicate,
               final Emoji... variants);  Emoji(@NonNull final int[] codePoints, @NonNull final String[] shortcodes,
               @DrawableRes final int resource, final boolean isDuplicate,
               final Emoji... variants); @NonNull String getUnicode(); @Nullable List<String> getShortcodes(); @Deprecated @DrawableRes int getResource(); @NonNull Drawable getDrawable(final Context context); boolean isDuplicate(); @NonNull List<Emoji> getVariants(); @NonNull Emoji getBase(); int getLength(); boolean hasVariants(); void destroy(); @Override boolean equals(final Object o); @Override int hashCode();  }
@Test public void baseWithoutVariant() { final Emoji emoji = new Emoji(0x1234, new String[]{"test"}, R.drawable.emoji_backspace, false); assertThat(emoji.getBase()).isSameAs(emoji); }
@Test public void baseWithVariant() { final Emoji variant = new Emoji(0x4321, new String[]{"test"}, R.drawable.emoji_recent, false); final Emoji emoji = new Emoji(0x1234, new String[]{"test"}, R.drawable.emoji_backspace, false, variant); assertThat(variant.getBase()).isSameAs(emoji); }
@Test public void baseWithMultipleVariants() { final Emoji variant = new Emoji(0x4321, new String[]{"test"}, R.drawable.emoji_recent, false); final Emoji variant2 = new Emoji(0x5678, new String[]{"test"}, R.drawable.emoji_recent, false); final Emoji emoji = new Emoji(0x1234, new String[]{"test"}, R.drawable.emoji_backspace, false, variant, variant2); assertThat(variant.getBase()).isSameAs(emoji); assertThat(variant2.getBase()).isSameAs(emoji); }
@Test public void baseWithRecursiveVariant() { final Emoji variantOfVariant = new Emoji(0x4321, new String[]{"test"}, R.drawable.emoji_recent, false); final Emoji variant = new Emoji(0x5678, new String[]{"test"}, R.drawable.emoji_recent, false, variantOfVariant); final Emoji emoji = new Emoji(0x1234, new String[]{"test"}, R.drawable.emoji_backspace, false, variant); assertThat(variantOfVariant.getBase()).isSameAs(emoji); assertThat(variant.getBase()).isSameAs(emoji); }