TypeInferenceUtils { public static boolean isDate(String value) { return SystemDateTimePatternManager.isDate(value); }  static boolean isDouble(String value); static boolean isInteger(String value); static boolean isNumber(String value); static BigInteger getBigInteger(String value); static boolean isBoolean(String value); static boolean isDate(String value); static boolean isTime(String value); static boolean isEmpty(String value); static boolean isValid(DataTypeEnum type, String value); static DataTypeEnum getDataType(String value); static DataTypeEnum getNativeDataType(String value);  }
@Test public void testIsDate() throws Exception { List<String> values = loadData("testDate.csv"); int countOfDates = 0; TypeInferenceUtils.isDate("12/02/99"); long timeStart = System.currentTimeMillis(); Assert.assertEquals(10000, values.size()); for (String value : values) { if (TypeInferenceUtils.isDate(value)) { countOfDates++; } } long timeEnd = System.currentTimeMillis(); Assert.assertEquals(5001, countOfDates); long difference = timeEnd - timeStart; LOGGER.debug("The method isDate spent " + difference + " ms on 10000 values."); }
@Test public void testIsDateddMMMyyyy() { String dateStr = "15-Sep-2014"; assertTrue(TypeInferenceUtils.isDate(dateStr)); }
@Test public void testIsJapaneseDateddMMMyyyy() { assertTrue(TypeInferenceUtils.isDate("22 5月 1999")); assertFalse(TypeInferenceUtils.isDate("22 18月 1999")); }