public static Date getDateFromString( String dateString ) throws ParseException {
    String dateFormat = detectDateFormat( dateString );
    if ( dateFormat == null ) {
      throw new ParseException( "Unknown date format.", 0 );
    }
    return getDateFromStringByFormat( dateString, dateFormat );
  }
@Test
  public void testGetDateFromStringLocale() throws ParseException {
    assertEquals( SAMPLE_DATE_US, DateDetector.getDateFromString( SAMPLE_DATE_STRING_US, LOCALE_en_US ) );
    try {
      DateDetector.getDateFromString( null );
    } catch ( ParseException e ) {
      // expected exception
    }
    try {
      DateDetector.getDateFromString( null, null );
    } catch ( ParseException e ) {
      // expected exception
    }
  }