Github user fhueske commented on a diff in the pull request: https://github.com/apache/flink/pull/5218#discussion_r159678062 --- Diff: flink-core/src/test/java/org/apache/flink/types/parser/FieldParserTest.java --- @@ -43,4 +46,100 @@ public void testEndsWithDelimiter() throws Exception { assertFalse(FieldParser.endsWithDelimiter(bytes, 3, delim)); } -} \ No newline at end of file + @Test + public void testNextStringEndPos() throws Exception { + + FieldParser parser = new TestFieldParser<String>(); + // single-char delimiter + byte[] singleCharDelim = "|".getBytes(ConfigConstants.DEFAULT_CHARSET); + + byte[] bytes1 = "a|".getBytes(ConfigConstants.DEFAULT_CHARSET); + assertEquals(1, parser.nextStringEndPos(bytes1, 0, bytes1.length, singleCharDelim)); + assertEquals(-1, parser.nextStringEndPos(bytes1, 1, bytes1.length, singleCharDelim)); + assertEquals(ParseErrorState.EMPTY_COLUMN, parser.getErrorState()); + + parser.resetParserState(); --- End diff -- please add ``` parser.resetParserState(); assertEquals(-1, parser.nextStringEndPos(bytes1, 2, bytes1.length, singleCharDelim)); assertEquals(ParseErrorState.EMPTY_COLUMN, parser.getErrorState()); ```
---