### Question:
DateFormatParser { public static DateTimeFormatter createDateTimeFormatter(String format) { DateTimeFormatterBuilder builder = new DateTimeFormatterBuilder(); for (Token token : tokenize(format)) { switch (token.getType()) { case DateFormat.TEXT: builder.appendLiteral(token.getText()); break; case DateFormat.DD: builder.appendDayOfMonth(2); break; case DateFormat.HH24: builder.appendHourOfDay(2); break; case DateFormat.HH: builder.appendHourOfHalfday(2); break; case DateFormat.MI: builder.appendMinuteOfHour(2); break; case DateFormat.MM: builder.appendMonthOfYear(2); break; case DateFormat.SS: builder.appendSecondOfMinute(2); break; case DateFormat.YY: builder.appendTwoDigitYear(2050); break; case DateFormat.YYYY: builder.appendYear(4, 4); break; case DateFormat.UNRECOGNIZED: default: throw new PrestoException( StandardErrorCode.INVALID_FUNCTION_ARGUMENT, format("Failed to tokenize string [%s] at offset [%d]", token.getText(), token.getCharPositionInLine())); } } try { return builder.toFormatter(); } catch (UnsupportedOperationException e) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, e); } } private  DateFormatParser(); static DateTimeFormatter createDateTimeFormatter(String format); static List<? extends Token> tokenize(String format);  }### Answer:
@Test(expectedExceptions = PrestoException.class) public void testInvalidTokenCreate1() { DateFormatParser.createDateTimeFormatter("ala"); }
@Test(expectedExceptions = PrestoException.class) public void testInvalidTokenCreate2() { DateFormatParser.createDateTimeFormatter("yyym/mm/dd"); }
@Test public void testCreateDateTimeFormatter() { DateTimeFormatter formatter = DateFormatParser.createDateTimeFormatter("yyyy/mm/dd"); assertEquals(formatter.parseDateTime("1988/04/08"), new DateTime(1988, 4, 8, 0, 0)); }