LocalDateToIntConverter { public static void checkValid(int date) { int year = date / 10000; int month = (date / 100) % 100; int day = date % 100; if (year < 0 && date != Integer.MIN_VALUE) { throw new IllegalArgumentException("Date must be year zero or later"); } if (year > 9999 && date != Integer.MAX_VALUE) { throw new IllegalArgumentException("Date must be year 9999 or earlier"); } if (month < 1 || month > 12 || day < 1 || day > 31) { throw new IllegalArgumentException("Invalid month-day"); } if (day > 29 && VALID_MONTH_DAY[(month - 1) * 2 + (day - 30)] == false) { throw new IllegalArgumentException("Invalid month-day"); } } private  LocalDateToIntConverter(); static int convertToInt(LocalDate date); static LocalDate convertToLocalDate(int date); static void checkValid(int date);  }
@Test(dataProvider = "invalid", expectedExceptions = IllegalArgumentException.class) public void test_checkInvalid(int date) { LocalDateToIntConverter.checkValid(date); }