MiscUtils { @Nullable public static String[] getGroupLogos(@Nullable final String logo) { if (!isValidArtwork(logo)) { return null; } final String replace; if (logo.contains('/' + Constants.IMAGE_TEMPLATE_MEDIUM + '.')) { replace = '/' + Constants.IMAGE_TEMPLATE_MEDIUM + '.'; } else if (logo.contains('/' + Constants.IMAGE_TEMPLATE_SMALL + '.')) { replace = '/' + Constants.IMAGE_TEMPLATE_SMALL + '.'; } else if (logo.contains('/' + Constants.IMAGE_TEMPLATE_THUMB + '.')) { replace = '/' + Constants.IMAGE_TEMPLATE_THUMB + '.'; } else if (logo.contains('/' + Constants.IMAGE_TEMPLATE_THUMB_SMALL + '.')) { replace = '/' + Constants.IMAGE_TEMPLATE_THUMB_SMALL + '.'; } else if (logo.contains('/' + Constants.IMAGE_TEMPLATE_ORIGINAL + '.')) { replace = '/' + Constants.IMAGE_TEMPLATE_ORIGINAL + '.'; } else { return new String[] { logo }; } return new String[] { logo.replaceFirst(replace, '/' + Constants.IMAGE_TEMPLATE_THUMB + '.'), logo.replaceFirst(replace, '/' + Constants.IMAGE_TEMPLATE_THUMB_SMALL + '.'), logo.replaceFirst(replace, '/' + Constants.IMAGE_TEMPLATE_SMALL + '.'), logo.replaceFirst(replace, '/' + Constants.IMAGE_TEMPLATE_MEDIUM + '.'), logo.replaceFirst(replace, '/' + Constants.IMAGE_TEMPLATE_ORIGINAL + '.') }; }  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 testGetGroupLogos() throws Exception { assertNull(MiscUtils.getGroupLogos(null)); assertNull(MiscUtils.getGroupLogos("")); assertNotNull(MiscUtils.getGroupLogos(LOGO0)); assertNotNull(MiscUtils.getGroupLogos(LOGO1)); assertNotNull(MiscUtils.getGroupLogos(LOGO2)); assertNotNull(MiscUtils.getGroupLogos(LOGO3)); assertNotNull(MiscUtils.getGroupLogos(LOGO4)); assertNotNull(MiscUtils.getGroupLogos(LOGO5)); assertNotNull(MiscUtils.getGroupLogos(LOGO6)); }