@Test public void parseColumnDataTypeBooleanTest(){ String columnDataTypeString = " BOOLEAN "; List<String> list = ParserUtils.parseColumnDataType(columnDataTypeString); Assert.assertEquals("Must contain 1 elements : ", 3, list.size()); Assert.assertEquals("Failed to find datatype. ", "BOOLEAN", list.get(0)); Assert.assertNull("Precision should be null. ", list.get(1)); Assert.assertNull("Scale should be null. ", list.get(2)); }
public static List<String> parseColumnDataType(String columnDataTypeString) { List<String> typePrecisionScale = new ArrayList<>(3); Pattern pattern = Pattern.compile(DATA_TYPE_REGEX); Matcher matcher = pattern.matcher(columnDataTypeString); if (matcher.find()) { typePrecisionScale.add(matcher.group(1)); typePrecisionScale.add(matcher.group(3)); typePrecisionScale.add(matcher.group(5)); }else{ typePrecisionScale.add(null); typePrecisionScale.add(null); typePrecisionScale.add(null); } return typePrecisionScale; }
ParserUtils { public static List<String> parseColumnDataType(String columnDataTypeString) { List<String> typePrecisionScale = new ArrayList<>(3); Pattern pattern = Pattern.compile(DATA_TYPE_REGEX); Matcher matcher = pattern.matcher(columnDataTypeString); if (matcher.find()) { typePrecisionScale.add(matcher.group(1)); typePrecisionScale.add(matcher.group(3)); typePrecisionScale.add(matcher.group(5)); }else{ typePrecisionScale.add(null); typePrecisionScale.add(null); typePrecisionScale.add(null); } return typePrecisionScale; } }
ParserUtils { public static List<String> parseColumnDataType(String columnDataTypeString) { List<String> typePrecisionScale = new ArrayList<>(3); Pattern pattern = Pattern.compile(DATA_TYPE_REGEX); Matcher matcher = pattern.matcher(columnDataTypeString); if (matcher.find()) { typePrecisionScale.add(matcher.group(1)); typePrecisionScale.add(matcher.group(3)); typePrecisionScale.add(matcher.group(5)); }else{ typePrecisionScale.add(null); typePrecisionScale.add(null); typePrecisionScale.add(null); } return typePrecisionScale; }  }
ParserUtils { public static List<String> parseColumnDataType(String columnDataTypeString) { List<String> typePrecisionScale = new ArrayList<>(3); Pattern pattern = Pattern.compile(DATA_TYPE_REGEX); Matcher matcher = pattern.matcher(columnDataTypeString); if (matcher.find()) { typePrecisionScale.add(matcher.group(1)); typePrecisionScale.add(matcher.group(3)); typePrecisionScale.add(matcher.group(5)); }else{ typePrecisionScale.add(null); typePrecisionScale.add(null); typePrecisionScale.add(null); } return typePrecisionScale; }  static List<String> parseColumnDataType(String columnDataTypeString); }
ParserUtils { public static List<String> parseColumnDataType(String columnDataTypeString) { List<String> typePrecisionScale = new ArrayList<>(3); Pattern pattern = Pattern.compile(DATA_TYPE_REGEX); Matcher matcher = pattern.matcher(columnDataTypeString); if (matcher.find()) { typePrecisionScale.add(matcher.group(1)); typePrecisionScale.add(matcher.group(3)); typePrecisionScale.add(matcher.group(5)); }else{ typePrecisionScale.add(null); typePrecisionScale.add(null); typePrecisionScale.add(null); } return typePrecisionScale; }  static List<String> parseColumnDataType(String columnDataTypeString); static final String DATA_TYPE_REGEX; }