### Question:
DateTimeUtilities { public static Date parse(DateFormat dateFormat, String source) throws ParseException { Date date = dateFormat.parse(fixMillis(source)); if (dateFormat instanceof SimpleDateFormat) { date = reducePrecision((SimpleDateFormat)dateFormat, date); } return date; } private  DateTimeUtilities(); static String fixMillis(String dateTimeString); static String generateISO8601DateString(Date date); static Date parse(DateFormat dateFormat, String source); static Date parseISO8601Date(String dateStr);  }### Answer:
@Test public void testParse() throws ParseException { SimpleDateFormat format = new SimpleDateFormat(DateTimeFormats.DATE_TIME_MILLIS_FORMAT); Assert.assertEquals(getDate(2013, 4, 9, 13, 38, 15, 123), DateTimeUtilities.parse(format, "2013-04-09 13:38:15.123")); Assert.assertEquals(getDate(2013, 4, 9, 13, 38, 15, 123), DateTimeUtilities.parse(format, "2013-04-09 13:38:15.1234")); Assert.assertEquals(getDate(2013, 4, 9, 13, 38, 15, 124), DateTimeUtilities.parse(format, "2013-04-09 13:38:15.1235")); Assert.assertEquals(getDate(2013, 4, 9, 13, 38, 16, 0), DateTimeUtilities.parse(format, "2013-04-09 13:38:15.9999")); Assert.assertEquals(getDate(2013, 4, 9, 13, 38, 15, 120), DateTimeUtilities.parse(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SS"), "2013-04-09 13:38:15.123")); Assert.assertEquals(getDate(2013, 4, 9, 13, 38, 15, 100), DateTimeUtilities.parse(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S"), "2013-04-09 13:38:15.123")); Assert.assertEquals(getDate(2013, 4, 9, 13, 38, 15, 200), DateTimeUtilities.parse(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S"), "2013-04-09 13:38:15.153")); }