TypeInferenceUtils { public static boolean isValid(DataTypeEnum type, String value) { switch (type) { case BOOLEAN: return isBoolean(value); case INTEGER: return isInteger(value); case DOUBLE: return isDouble(value); case DATE: return isDate(value); case STRING: return true; default: return false; } }  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 testIsValid() { Assert.assertTrue(TypeInferenceUtils.isValid(DataTypeEnum.BOOLEAN, "true")); Assert.assertTrue(TypeInferenceUtils.isValid(DataTypeEnum.INTEGER, "123")); Assert.assertTrue(TypeInferenceUtils.isValid(DataTypeEnum.DOUBLE, "1045.35")); Assert.assertTrue(TypeInferenceUtils.isValid(DataTypeEnum.STRING, "abc")); Assert.assertTrue(TypeInferenceUtils.isValid(DataTypeEnum.DATE, "2019-12-25")); Assert.assertFalse(TypeInferenceUtils.isValid(DataTypeEnum.TIME, "15:23:56")); Assert.assertFalse(TypeInferenceUtils.isValid(DataTypeEnum.EMPTY, "")); }