### Question:
DateUtil { public static Date parseString(String string, String format) throws ParseException { return new SimpleDateFormat(format).parse(string); }  static Date getMonthStartDate(Date date); static Date getMonthEndDate(Date date); static int maxMonthDate(Date date); static Date addDayOfMonth(Date date); static Date addDayOfMonth(Date date, int difference); static Date addMonth(Date date, int difference); static Calendar calendarDate(Date date); static boolean equal(Date date1, Date date2); static int dayNumber(Date date); static String formatDate(Date date); static String formatDate(Date date, String format); static Date parseString(String string, String format); static Date today(); static int numDaysToEndOfMonth(); static int monthNumber(Date date); static int monthNumber(); static SimpleDateFormat dateFormater; }### Answer:
@Test public void shouldParseString() throws Exception { String format = "yyyyMMdd"; String dateString = "20150101"; Date expectedDate = new SimpleDateFormat("yyyyMMdd").parse("20150101"); assertThat(DateUtil.parseString(dateString, format), is(expectedDate)); }