### Question:
DateUtils { static boolean isExpiryDataValid(int expiryMonth, int expiryYear) { return isExpiryDataValid(expiryMonth, expiryYear, Calendar.getInstance()); }    }### Answer:
@Test public void isExpiryDataValid_whenDateIsAfterCalendarYear_returnsTrue() { Calendar testCalendar = Calendar.getInstance(); testCalendar.set(Calendar.YEAR, 2018); testCalendar.set(Calendar.MONTH, Calendar.JANUARY); assertTrue(DateUtils.isExpiryDataValid(1, 2019, testCalendar)); }
@Test public void isExpiryDataValid_whenDateIsSameCalendarYearButLaterMonth_returnsTrue() { Calendar testCalendar = Calendar.getInstance(); testCalendar.set(Calendar.YEAR, 2018); testCalendar.set(Calendar.MONTH, Calendar.JANUARY); assertTrue(DateUtils.isExpiryDataValid(2, 2018, testCalendar)); }
@Test public void isExpiryDataValid_whenDateIsSameCalendarYearAndMonth_returnsTrue() { Calendar testCalendar = Calendar.getInstance(); testCalendar.set(Calendar.YEAR, 2018); testCalendar.set(Calendar.MONTH, Calendar.JANUARY); assertTrue(DateUtils.isExpiryDataValid(1, 2018, testCalendar)); }
@Test public void isExpiryDataValid_whenDateIsSameCalendarYearButEarlierMonth_returnsFalse() { Calendar testCalendar = Calendar.getInstance(); testCalendar.set(Calendar.YEAR, 2018); testCalendar.set(Calendar.MONTH, Calendar.MARCH); assertFalse(DateUtils.isExpiryDataValid(1, 2018, testCalendar)); }
@Test public void isExpiryDataValid_whenMonthIsInvalid_returnsFalse() { assertFalse(DateUtils.isExpiryDataValid(15, 2019)); assertFalse(DateUtils.isExpiryDataValid(-1, 2019)); }
@Test public void isExpiryDataValid_whenYearIsInvalid_returnsFalse() { assertFalse(DateUtils.isExpiryDataValid(5, -1)); assertFalse("Should not validate years beyond 9980", DateUtils.isExpiryDataValid(5, 9985)); }