@Test(expected = IllegalArgumentException.class) public void convertWeekdayToDayOfWeekTestIllegalArgumentTest() { Utils.convertWeekdayToDayOfWeek("dsfgdsfg"); }
public static DayOfWeek convertWeekdayToDayOfWeek(@NonNull String weekday) { switch (weekday.toLowerCase()) { case "понедельник": return DayOfWeek.MONDAY; case "вторник": return DayOfWeek.TUESDAY; case "среда": return DayOfWeek.WEDNESDAY; case "четверг": return DayOfWeek.THURSDAY; case "пятница": return DayOfWeek.FRIDAY; case "суббота": return DayOfWeek.SATURDAY; case "воскресенье": return DayOfWeek.SUNDAY; default: throw new IllegalArgumentException("Unknown weekday: " + weekday); } }
Utils { public static DayOfWeek convertWeekdayToDayOfWeek(@NonNull String weekday) { switch (weekday.toLowerCase()) { case "понедельник": return DayOfWeek.MONDAY; case "вторник": return DayOfWeek.TUESDAY; case "среда": return DayOfWeek.WEDNESDAY; case "четверг": return DayOfWeek.THURSDAY; case "пятница": return DayOfWeek.FRIDAY; case "суббота": return DayOfWeek.SATURDAY; case "воскресенье": return DayOfWeek.SUNDAY; default: throw new IllegalArgumentException("Unknown weekday: " + weekday); } } }
Utils { public static DayOfWeek convertWeekdayToDayOfWeek(@NonNull String weekday) { switch (weekday.toLowerCase()) { case "понедельник": return DayOfWeek.MONDAY; case "вторник": return DayOfWeek.TUESDAY; case "среда": return DayOfWeek.WEDNESDAY; case "четверг": return DayOfWeek.THURSDAY; case "пятница": return DayOfWeek.FRIDAY; case "суббота": return DayOfWeek.SATURDAY; case "воскресенье": return DayOfWeek.SUNDAY; default: throw new IllegalArgumentException("Unknown weekday: " + weekday); } } private  Utils(); }
Utils { public static DayOfWeek convertWeekdayToDayOfWeek(@NonNull String weekday) { switch (weekday.toLowerCase()) { case "понедельник": return DayOfWeek.MONDAY; case "вторник": return DayOfWeek.TUESDAY; case "среда": return DayOfWeek.WEDNESDAY; case "четверг": return DayOfWeek.THURSDAY; case "пятница": return DayOfWeek.FRIDAY; case "суббота": return DayOfWeek.SATURDAY; case "воскресенье": return DayOfWeek.SUNDAY; default: throw new IllegalArgumentException("Unknown weekday: " + weekday); } } private  Utils(); static void openPlayStorePage(Context context); static void openPrivacyPolicyPage(Context context); static String getFormattedTitle(String titleFormat, String... strings); static boolean hasNetworkConnection(Context context); static void setNotificationAlarm(Context context, LocalTime localTime); static void cancelNotificationAlarm(Context context); static void setWidgetUpdateAlarm(Context context); static void cancelWidgetUpdateAlarm(Context context); static void restartApp(Activity activity); static int getCurrentWeekNumber(); static int getWeekNumber(LocalDate localDate); static DayOfWeek convertWeekdayToDayOfWeek(@NonNull String weekday); static void unsubscribe(Subscription subscription); static void unsubscribeComposite(CompositeSubscription compositeSubscription); static int[] getAppWidgetIds(Context context); }
Utils { public static DayOfWeek convertWeekdayToDayOfWeek(@NonNull String weekday) { switch (weekday.toLowerCase()) { case "понедельник": return DayOfWeek.MONDAY; case "вторник": return DayOfWeek.TUESDAY; case "среда": return DayOfWeek.WEDNESDAY; case "четверг": return DayOfWeek.THURSDAY; case "пятница": return DayOfWeek.FRIDAY; case "суббота": return DayOfWeek.SATURDAY; case "воскресенье": return DayOfWeek.SUNDAY; default: throw new IllegalArgumentException("Unknown weekday: " + weekday); } } private  Utils(); static void openPlayStorePage(Context context); static void openPrivacyPolicyPage(Context context); static String getFormattedTitle(String titleFormat, String... strings); static boolean hasNetworkConnection(Context context); static void setNotificationAlarm(Context context, LocalTime localTime); static void cancelNotificationAlarm(Context context); static void setWidgetUpdateAlarm(Context context); static void cancelWidgetUpdateAlarm(Context context); static void restartApp(Activity activity); static int getCurrentWeekNumber(); static int getWeekNumber(LocalDate localDate); static DayOfWeek convertWeekdayToDayOfWeek(@NonNull String weekday); static void unsubscribe(Subscription subscription); static void unsubscribeComposite(CompositeSubscription compositeSubscription); static int[] getAppWidgetIds(Context context);  }