@Test
public void testParseValidQuotedStringsWithoutWhitespaces() {
// check valid strings with out whitespaces and trailing delimiter
byte[] recBytes = "\"abcdefgh\"|\"i\"|\"jklmno\"|".getBytes();
StringValue s = new StringValue();
int startPos = 0;
startPos = parser.parseField(recBytes, startPos, recBytes.length, '|', s);
assertTrue(startPos == 11);
assertTrue(s.getValue().equals("abcdefgh"));
startPos = parser.parseField(recBytes, startPos, recBytes.length, '|', s);
assertTrue(startPos == 15);
assertTrue(s.getValue().equals("i"));
startPos = parser.parseField(recBytes, startPos, recBytes.length, '|', s);
assertTrue(startPos == 24);
assertTrue(s.getValue().equals("jklmno"));
// check single field not terminated
recBytes = "\"abcde\"".getBytes();
startPos = 0;
startPos = parser.parseField(recBytes, startPos, recBytes.length, '|', s);
assertTrue(startPos == 7);
assertTrue(s.getValue().equals("abcde"));
// check last field not terminated
recBytes = "\"abcde\"|\"fg\"".getBytes();
startPos = 0;
startPos = parser.parseField(recBytes, startPos, recBytes.length, '|', s);
assertTrue(startPos == 8);
assertTrue(s.getValue().equals("abcde"));
startPos = parser.parseField(recBytes, startPos, recBytes.length, '|', s);
assertTrue(startPos == 12);
assertTrue(s.getValue().equals("fg"));
// check delimiter in quotes
recBytes = "\"abcde|fg\"|\"hij|kl|mn|op\"|".getBytes();
startPos = 0;
startPos = parser.parseField(recBytes, startPos, recBytes.length, '|', s);
assertTrue(startPos == 11);
assertTrue(s.getValue().equals("abcde|fg"));
startPos = parser.parseField(recBytes, startPos, recBytes.length, '|', s);
assertTrue(startPos == 26);
assertTrue(s.getValue().equals("hij|kl|mn|op"));
// check delimiter in quotes last field not terminated
recBytes = "\"abcde|fg\"|\"hij|kl|mn|op\"".getBytes();
startPos = 0;
startPos = parser.parseField(recBytes, startPos, recBytes.length, '|', s);
assertTrue(startPos == 11);
assertTrue(s.getValue().equals("abcde|fg"));
startPos = parser.parseField(recBytes, startPos, recBytes.length, '|', s);
assertTrue(startPos == 25);
assertTrue(s.getValue().equals("hij|kl|mn|op"));
}