Express intention of tokens in token content and give test more structure

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1465705 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benedikt Ritter 2013-04-08 18:23:32 +00:00
parent 1c728b40e5
commit 4c8024fb76
1 changed files with 6 additions and 9 deletions

View File

@ -60,16 +60,13 @@ public class CSVLexerTest {
// Single line (without comment) // Single line (without comment)
@Test @Test
public void testIgnoreSurroundingSpacesAreDeleted() throws IOException { public void testIgnoreSurroundingSpacesAreDeleted() throws IOException {
final String code = "abc,def, hijk, lmnop, qrst,uv ,wxy ,z , ,"; final String code = "noSpaces, leadingSpaces,trailingSpaces , surroundingSpaces , ,,";
final Lexer parser = getLexer(code, CSVFormat.newBuilder().withIgnoreSurroundingSpaces(true).build()); final Lexer parser = getLexer(code, CSVFormat.newBuilder().withIgnoreSurroundingSpaces(true).build());
assertThat(parser.nextToken(new Token()), matches(TOKEN, "abc")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "noSpaces"));
assertThat(parser.nextToken(new Token()), matches(TOKEN, "def")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "leadingSpaces"));
assertThat(parser.nextToken(new Token()), matches(TOKEN, "hijk")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "trailingSpaces"));
assertThat(parser.nextToken(new Token()), matches(TOKEN, "lmnop")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "surroundingSpaces"));
assertThat(parser.nextToken(new Token()), matches(TOKEN, "qrst")); assertThat(parser.nextToken(new Token()), matches(TOKEN, ""));
assertThat(parser.nextToken(new Token()), matches(TOKEN, "uv"));
assertThat(parser.nextToken(new Token()), matches(TOKEN, "wxy"));
assertThat(parser.nextToken(new Token()), matches(TOKEN, "z"));
assertThat(parser.nextToken(new Token()), matches(TOKEN, "")); assertThat(parser.nextToken(new Token()), matches(TOKEN, ""));
assertThat(parser.nextToken(new Token()), matches(EOF, "")); assertThat(parser.nextToken(new Token()), matches(EOF, ""));
} }