Utils { public static String getMonth(int monthValue) { switch (monthValue) { case 1: return "January"; case 2: return "February"; case 3: return "March"; case 4: return "April"; case 5: return "May"; case 6: return "June"; case 7: return "July"; case 8: return "August"; case 9: return "September"; case 10: return "October"; case 11: return "November"; case 12: return "December"; default: return "Invalid Month"; } }  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 getMonthTest() { Assert.assertEquals("January", Utils.getMonth(1)); Assert.assertEquals("February", Utils.getMonth(2)); Assert.assertEquals("March", Utils.getMonth(3)); Assert.assertEquals("April", Utils.getMonth(4)); Assert.assertEquals("May", Utils.getMonth(5)); Assert.assertEquals("June", Utils.getMonth(6)); Assert.assertEquals("July", Utils.getMonth(7)); Assert.assertEquals("August", Utils.getMonth(8)); Assert.assertEquals("September", Utils.getMonth(9)); Assert.assertEquals("October", Utils.getMonth(10)); Assert.assertEquals("November", Utils.getMonth(11)); Assert.assertEquals("December", Utils.getMonth(12)); }
@Test public void getMonthTest_invalid() { Assert.assertEquals("Invalid Month", Utils.getMonth(123)); }