Utils { public static String getFormattedCreditCardNumber(String unformattedCardNumber) { StringBuilder builder = new StringBuilder(); if (unformattedCardNumber.length() == 16) { for (int i = 0; i < 16; i += 4) { builder.append(unformattedCardNumber.substring(i, i + 4)); builder.append(" "); } } return builder.toString(); }  static String mappingToCreditCardAuthentication(String type, boolean secure); static boolean isNetworkAvailable(Context context); static void hideKeyboard(Context context, View editText); static String getFormattedAmount(double amount); static String getValidityTime(String transactionTime); static String getMonth(int monthValue); static int dpToPx(int dp); static String getFormattedCreditCardNumber(String unformattedCardNumber); static String getCardType(@NonNull String cardNo); static String getFormattedTime(long time); static String formatDouble(double d); static String getDeviceType(Activity activity); static final String CARD_TYPE_VISA; static final String CARD_TYPE_MASTERCARD; static final String CARD_TYPE_AMEX; static final String CARD_TYPE_JCB; }
@Test public void formatCCTest() { String formatedCC = Utils.getFormattedCreditCardNumber(ccNumberSample); Assert.assertEquals(ccFormatedCCNumberSample, formatedCC); }