@Test public void should_not_detect_char_or_digit_separator_candidate() { Map<Character, Separator> separatorMap = new HashMap<>(); char[] cases = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".toCharArray(); for (char candidate : cases) { csvSchemaParser.processCharAsSeparatorCandidate(candidate, separatorMap, CSVSchemaParser.DEFAULT_VALID_SEPARATORS, 0); } assertTrue(separatorMap.isEmpty()); }
protected void processCharAsSeparatorCandidate(char candidate, Map<Character, Separator> separatorMap, List<Character> validSeparators, int lineNumber) { if (validSeparators.contains(candidate)) { updateSeparatorMap(candidate, separatorMap, lineNumber); } }
CSVSchemaParser implements SchemaParser { protected void processCharAsSeparatorCandidate(char candidate, Map<Character, Separator> separatorMap, List<Character> validSeparators, int lineNumber) { if (validSeparators.contains(candidate)) { updateSeparatorMap(candidate, separatorMap, lineNumber); } } }
CSVSchemaParser implements SchemaParser { protected void processCharAsSeparatorCandidate(char candidate, Map<Character, Separator> separatorMap, List<Character> validSeparators, int lineNumber) { if (validSeparators.contains(candidate)) { updateSeparatorMap(candidate, separatorMap, lineNumber); } }  }
CSVSchemaParser implements SchemaParser { protected void processCharAsSeparatorCandidate(char candidate, Map<Character, Separator> separatorMap, List<Character> validSeparators, int lineNumber) { if (validSeparators.contains(candidate)) { updateSeparatorMap(candidate, separatorMap, lineNumber); } }  @Override boolean accept(DataSetMetadata metadata); @Override Schema parse(Request request); Map<String, String> guess(SchemaParser.Request request, String encoding); }
CSVSchemaParser implements SchemaParser { protected void processCharAsSeparatorCandidate(char candidate, Map<Character, Separator> separatorMap, List<Character> validSeparators, int lineNumber) { if (validSeparators.contains(candidate)) { updateSeparatorMap(candidate, separatorMap, lineNumber); } }  @Override boolean accept(DataSetMetadata metadata); @Override Schema parse(Request request); Map<String, String> guess(SchemaParser.Request request, String encoding); static final List<Character> DEFAULT_VALID_SEPARATORS; }