### Question:
TimestampValidator implements ValidationPolicy<String> { public DateTime parseTimestamp(String value) { if ((allowNull) && (value.toUpperCase().equals("NULL"))) { return new DateTime(); } int cnt = value.length(); if (cnt < MIN_LENGTH || cnt > MAX_LENGTH) { throw new IllegalArgumentException("Unexpected format"); } if (value.charAt(10) == 'T') { return DATETIME_ISO8601.parseDateTime(value); } else if (cnt == MIN_LENGTH) { return DATETIME_NOMILLIS.parseDateTime(value); } else if (cnt == MAX_LENGTH) { return DATETIME_NANOS.parseDateTime(value); } else { return DATETIME_MILLIS.parseDateTime(value); } } TimestampValidator(@PolicyPropertyRef(name = "allowNull") boolean allowNull);  TimestampValidator(); @Override boolean validate(String value); DateTime parseTimestamp(String value); boolean getAllowNull(); boolean isAllowNull(); void setAllowNull(boolean allowNull);  }### Answer:
@Test public void testParse() throws Exception { TimestampValidator ts = new TimestampValidator(false); assertNotNull(ts.parseTimestamp("2015-01-15 11:10:20.333")); assertNotNull(ts.parseTimestamp("2015-01-15 11:10:20")); try { ts.parseTimestamp("2015-01-15"); fail(); } catch (IllegalArgumentException e) { } }