MiscUtils { public static boolean booleanEquals(@Nullable final Boolean lhs, @Nullable final Boolean rhs) { return lhs == null && rhs == null || lhs != null && rhs != null && lhs.equals(rhs); }  static boolean booleanEquals(@Nullable final Boolean lhs, @Nullable final Boolean rhs); static void closeKeyboard(final Activity activity); static void exclusiveAdd(final List<T> list, @Nullable final List<T> elementsToAdd); static Activity getActivity(final Context context); @ColorInt static int getAttrColor(final Context context, @AttrRes final int colorResId); @ColorInt static int getDrawableColor(final Context context, @Nullable final Drawable drawable); @ColorInt static int getDrawableColor(final View view, @Nullable final Drawable drawable); static CharSequence getElapsedTime(final Resources res, long seconds); @Nullable static String[] getGroupLogos(@Nullable final String logo); static LayerDrawable getStatusBarScrim(final Context context,
            @Nullable final Drawable statusBarBackground); @Nullable static String[] getUserAvatars(@Nullable final String avatar); static int integerCompare(final int lhs, final int rhs); static boolean integerEquals(@Nullable final Integer lhs, @Nullable final Integer rhs); static boolean isLowRamDevice(); static boolean isValidArtwork(final String url); static void openKeyboard(final Context context, final View view); static void openUrl(final Activity activity, final String url); static void openUrl(final Context context, final String url); @Nullable static Activity optActivity(@Nullable final Context context); @Nullable static ArrayList<T> toArrayList(@Nullable final Collection<T> collection);  }
@Test public void testBooleanEquals() throws Exception { assertTrue(MiscUtils.booleanEquals(null, null)); assertTrue(MiscUtils.booleanEquals(Boolean.TRUE, Boolean.TRUE)); assertTrue(MiscUtils.booleanEquals(Boolean.TRUE, true)); assertTrue(MiscUtils.booleanEquals(true, Boolean.TRUE)); assertTrue(MiscUtils.booleanEquals(true, true)); assertTrue(MiscUtils.booleanEquals(Boolean.FALSE, Boolean.FALSE)); assertTrue(MiscUtils.booleanEquals(Boolean.FALSE, false)); assertTrue(MiscUtils.booleanEquals(false, Boolean.FALSE)); assertTrue(MiscUtils.booleanEquals(false, false)); assertFalse(MiscUtils.booleanEquals(Boolean.TRUE, Boolean.FALSE)); assertFalse(MiscUtils.booleanEquals(Boolean.TRUE, false)); assertFalse(MiscUtils.booleanEquals(Boolean.TRUE, null)); assertFalse(MiscUtils.booleanEquals(true, Boolean.FALSE)); assertFalse(MiscUtils.booleanEquals(true, false)); assertFalse(MiscUtils.booleanEquals(true, null)); assertFalse(MiscUtils.booleanEquals(Boolean.FALSE, Boolean.TRUE)); assertFalse(MiscUtils.booleanEquals(Boolean.FALSE, true)); assertFalse(MiscUtils.booleanEquals(Boolean.FALSE, null)); assertFalse(MiscUtils.booleanEquals(false, Boolean.TRUE)); assertFalse(MiscUtils.booleanEquals(false, true)); assertFalse(MiscUtils.booleanEquals(false, null)); }