MySQLColumn { public static Collection<String> getValues(String type) { Collection<String> values = newArrayList(); int count = 0; boolean start = false; boolean escape = false; int startIndex = 0; int index = 0; StringBuilder value = new StringBuilder(); int length = type.length(); char lastSymbol = 0; while (index < length) { char symbol = type.charAt(index); boolean addSymbol = false; boolean addValue = false; switch (symbol) { case '\'': if (start && (lastSymbol == '\'' && index > startIndex)) { addSymbol = true; } if (!start) { start = true; startIndex = index + 1; count++; } break; case ',': addSymbol = escape; if (start && !escape) { addValue = true; start = false; } break; case ' ': addSymbol = start; break; case '\\': addSymbol = escape; escape = !escape; break; default: addSymbol = true; break; } if (addSymbol) { value.append(symbol); } if (addValue) { values.add(value.toString()); value.setLength(0); start = false; } index++; lastSymbol = symbol; } if (count > values.size()) { values.add(value.toString()); } return values; }  static JdbcType getJdbcType(JdbcType baseType, String type); static Collection<String> getEnum(JdbcType baseType, String type); static Collection<String> getSet(JdbcType baseType, String type); static Collection<String> getValues(String type); static String ENUM; static String SET; static String YEAR; }
@Test(dataProvider = "getValues") public void testGetValues(String type, Collection<String> values) { assertEquals(getValues(type), values, format("Expecting %s values parsed out from source type \"%s\"", values, type)); }