BATCH-700:FixedLengthTokenizer didn't support single value ranges when calculating the maximum line length.

This commit is contained in:
lucasward
2008-07-11 04:14:53 +00:00
parent a61b725bc2
commit 402bb81c40
3 changed files with 28 additions and 7 deletions

View File

@@ -122,6 +122,18 @@ public class FixedLengthTokenizerTests extends TestCase {
assertEquals(line.substring(15, 25).trim(), tokens.readString(2));
assertEquals(line.substring(25).trim(), tokens.readString(3));
}
public void testFillerAtEnd() throws Exception {
tokenizer.setColumns(new Range[] {new Range(1,5),new Range(6,15),new Range(16,25),new Range(26,27),new Range(34)});
// test another type of record
line = "H2 123456 12345 12-123456";
FieldSet tokens = tokenizer.tokenize(line);
assertEquals(5, tokens.getFieldCount());
assertEquals(line.substring(0, 5).trim(), tokens.readString(0));
assertEquals(line.substring(5, 15).trim(), tokens.readString(1));
assertEquals(line.substring(15, 25).trim(), tokens.readString(2));
assertEquals(line.substring(25, 27).trim(), tokens.readString(3));
}
public void testTokenizerInvalidSetup() {
tokenizer.setNames(new String[] {"a", "b"});