Added test to DelimitedLineTokenizer based on StackOverflow Question

A question was asked on StackOverflow
(http://stackoverflow.com/questions/25914945/spring-batch-delimitedlinetokenizer-with-line-breaks-newline-in-csv)
in which a row wasn't being parsed as expected.  We didn't have a test
for that specific scenario so this commit adds one.
This commit is contained in:
Michael Minella
2014-09-18 10:41:35 -05:00
parent 44fc2b1069
commit fc2431332b

View File

@@ -16,12 +16,12 @@
package org.springframework.batch.item.file.transform;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.junit.Test;
public class DelimitedLineTokenizerTests {
@@ -365,4 +365,12 @@ public class DelimitedLineTokenizerTests {
assertEquals("c", line.readString("bar"));
}
@Test
public void testTokenizeOverMultipleLines() {
tokenizer = new DelimitedLineTokenizer(";");
FieldSet line = tokenizer.tokenize("value1;\"value2\nvalue2cont\";value3;value4");
assertEquals(4, line.getFieldCount());
assertEquals("value2\nvalue2cont", line.readString(1));
}
}