### Question:
DateUtils { public static TimeZone getTimeZone(String tzId) { if (tzId == null) { throw new IllegalArgumentException("Invalid TimeZone: " + tzId); } tzId = handleGMTOffsetTZNames(tzId); TimeZone tz = TimeZone.getTimeZone(tzId); if (isThreeLetterTZName(tzId)) { LOG.warn("GMT, UTC or Region/City Timezone formats are preferred instead of [" + tzId + "]"); } if (!tz.getID().equals(tzId)) { throw new IllegalArgumentException("Invalid TimeZone: " + tzId); } return tz; }  static void setConf(Configuration conf); static TimeZone getOozieProcessingTimeZone(); static String getOozieTimeMask(); static TimeZone getTimeZone(String tzId); static Date parseDateUTC(String s); static Date parseDateOozieTZ(String s); static String formatDateOozieTZ(Date d); static String formatDateCustom(Date d, String format); static String formatDateEpoch(Date d, Boolean millis); static String formatDateOozieTZ(Calendar c); static String formatDate(Calendar c); static int hoursInDay(Calendar cal); static boolean isDSTChangeDay(Calendar cal); static void moveToEnd(Calendar cal, TimeUnit endOfFlag); static Calendar getCalendar(String dateString, TimeZone tz); static Calendar getCalendar(String dateString); static java.util.Date toDate(java.sql.Timestamp timestamp); static Timestamp convertDateToTimestamp(Date d); static final TimeZone UTC; static final String ISO8601_UTC_MASK; static final String OOZIE_PROCESSING_TIMEZONE_KEY; static final String OOZIE_PROCESSING_TIMEZONE_DEFAULT; }### Answer:
@Test public void testGetTimeZoneValidFormats() throws Exception { Assert.assertEquals(TimeZone.getTimeZone("America/Los_Angeles"), DateUtils.getTimeZone("America/Los_Angeles")); Assert.assertEquals(TimeZone.getTimeZone("PST"), DateUtils.getTimeZone("PST")); Assert.assertEquals(TimeZone.getTimeZone("GMT"), DateUtils.getTimeZone("GMT")); TimeZone GMTOffsetColon = TimeZone.getTimeZone("GMT-07:00"); TimeZone GMTOffsetNoColon = TimeZone.getTimeZone("GMT-0700"); TimeZone oozieGMTOffsetColon = DateUtils.getTimeZone("GMT-07:00"); TimeZone oozieGMTOffsetNoColon = DateUtils.getTimeZone("GMT-0700"); Assert.assertEquals(GMTOffsetColon, GMTOffsetNoColon); Assert.assertEquals(GMTOffsetNoColon, oozieGMTOffsetColon); Assert.assertEquals(oozieGMTOffsetColon, oozieGMTOffsetNoColon); Assert.assertFalse(TimeZone.getTimeZone("GMT").equals(oozieGMTOffsetNoColon)); GMTOffsetColon = TimeZone.getTimeZone("GMT+05:30"); GMTOffsetNoColon = TimeZone.getTimeZone("GMT+0530"); oozieGMTOffsetColon = DateUtils.getTimeZone("GMT+05:30"); oozieGMTOffsetNoColon = DateUtils.getTimeZone("GMT+0530"); Assert.assertEquals(GMTOffsetColon, GMTOffsetNoColon); Assert.assertEquals(GMTOffsetNoColon, oozieGMTOffsetColon); Assert.assertEquals(oozieGMTOffsetColon, oozieGMTOffsetNoColon); Assert.assertFalse(TimeZone.getTimeZone("GMT").equals(oozieGMTOffsetNoColon)); }
@Test(expected = IllegalArgumentException.class) public void testGetTimeZoneInvalidFormat() throws Exception { DateUtils.getTimeZone("This_is_not_a_TimeZone_id"); }
@Test(expected = IllegalArgumentException.class) public void testGetTimeZoneInvalidFormatNull() throws Exception { DateUtils.getTimeZone(null); }