### Question:
DateFromString { public static Date getDateUsingSimpleDateFormat(String dateString, String dateFormatString) { int smallestIndex = dateString.length(); if (smallestIndex == 0) return null; for (int i = 0; i < 10; i++) { int curIndex = dateString.indexOf(String.valueOf(i)); if (curIndex != -1 && smallestIndex > curIndex) smallestIndex = curIndex; } return getDateUsingCompleteDateFormatWithOffset(dateString, dateFormatString, smallestIndex); }  static Date getDateUsingSimpleDateFormat(String dateString, String dateFormatString); static Date getDateUsingDemarkatedCount(String dateString, String dateFormatString, char demark); static Date getDateUsingDemarkatedMatch(String dateString, String dateFormatString, char demark); static Date getDateUsingCompleteDateFormat(String dateString, String dateFormatString); static Date getDateUsingCompleteDateFormatWithOffset(String dateString, String dateFormatString,
      int startIndex); static Date getDateUsingRegExp(String dateString, String matchPattern, String substitutionPattern); static Date getDateUsingRegExpAndDateFormat(String dateString, String matchPattern, String substitutionPattern,
      String dateFormatString);  }### Answer:
@Test public void testGetDateUsingSimpleDateFormat() { String dateFormatString = "yyyyMMdd_HHmm"; Date date = DateFromString.getDateUsingSimpleDateFormat(fileName, dateFormatString); assertThat(date.getTime()).isEqualTo(dateAsLong); }