Exemplo n.º 1
0
 private void assertNextToken(CSVTokenizer tokenizer, CSVTokenType tokenType, String cell)
     throws IOException {
   CSVTokenType found = tokenizer.next();
   assertEquals(tokenType, found);
   assertEquals(tokenType, tokenizer.ttype);
   assertEquals(cell, tokenizer.cell);
 }
Exemplo n.º 2
0
 @Test
 public void testSkipLine() throws IOException {
   // testing \r
   CSVTokenizer tokenizer = createTokenizer("1\r2");
   tokenizer.skipLine();
   assertNextToken(tokenizer, CELL, "2");
   assertNextToken(tokenizer, EOF, null);
   // testing \n
   tokenizer = createTokenizer("1\r\n2");
   tokenizer.skipLine();
   assertNextToken(tokenizer, CELL, "2");
   assertNextToken(tokenizer, EOF, null);
   // testing \r\n
   tokenizer = createTokenizer("1\n2");
   tokenizer.skipLine();
   assertNextToken(tokenizer, CELL, "2");
   assertNextToken(tokenizer, EOF, null);
 }