Skip to content

Commit ee95ad7

Browse files
committed
Removing System outs - SANDBOX-217
git-svn-id: https://svn.apache.org/repos/asf/commons/sandbox/csv/trunk@631129 13f79535-47bb-0310-9956-ffa450edef68
1 parent 5b0ffe4 commit ee95ad7

1 file changed

Lines changed: 1 addition & 55 deletions

File tree

src/test/org/apache/commons/csv/CSVParserTest.java

Lines changed: 1 addition & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,7 @@ class TestCSVParser extends CSVParser {
5555
*/
5656
public String testNextToken() throws IOException {
5757
Token t = super.nextToken();
58-
String tmp = Integer.toString(t.type) + ";" + t.content + ";";
59-
System.out.println("token=" + tmp);
60-
return tmp;
58+
return Integer.toString(t.type) + ";" + t.content + ";";
6159
}
6260
}
6361

@@ -87,7 +85,6 @@ public void testNextToken1() throws IOException {
8785
String code = "abc,def, hijk, lmnop, qrst,uv ,wxy ,z , ,";
8886
TestCSVParser parser = new TestCSVParser(new StringReader(code));
8987
parser.setStrategy(CSVStrategy.DEFAULT_STRATEGY);
90-
System.out.println("---------\n" + code + "\n-------------");
9188
assertEquals(CSVParser.TT_TOKEN + ";abc;", parser.testNextToken());
9289
assertEquals(CSVParser.TT_TOKEN + ";def;", parser.testNextToken());
9390
assertEquals(CSVParser.TT_TOKEN + ";hijk;", parser.testNextToken());
@@ -114,7 +111,6 @@ public void testNextToken2() throws IOException {
114111
parser.getStrategy().setIgnoreEmptyLines(false);
115112
parser.setStrategy(CSVStrategy.DEFAULT_STRATEGY);
116113
parser.getStrategy().setCommentStart('#');
117-
System.out.println("---------\n" + code + "\n-------------");
118114
assertEquals(CSVParser.TT_TOKEN + ";1;", parser.testNextToken());
119115
assertEquals(CSVParser.TT_TOKEN + ";2;", parser.testNextToken());
120116
assertEquals(CSVParser.TT_TOKEN + ";3;", parser.testNextToken());
@@ -140,7 +136,6 @@ public void testNextToken3() throws IOException {
140136
TestCSVParser parser = new TestCSVParser(new StringReader(code));
141137
parser.setStrategy(CSVStrategy.DEFAULT_STRATEGY);
142138
parser.getStrategy().setCommentStart('#');
143-
System.out.println("---------\n" + code + "\n-------------");
144139
assertEquals(CSVParser.TT_TOKEN + ";a;", parser.testNextToken());
145140
// an unquoted single backslash is not an escape char
146141
assertEquals(CSVParser.TT_TOKEN + ";\\;", parser.testNextToken());
@@ -163,7 +158,6 @@ public void testNextToken4() throws IOException {
163158
"a,\"foo\",b\na, \" foo\",b\na,\"foo \" ,b\na, \" foo \" ,b";
164159
TestCSVParser parser = new TestCSVParser(new StringReader(code));
165160
parser.setStrategy(CSVStrategy.DEFAULT_STRATEGY);
166-
System.out.println("---------\n" + code + "\n-------------");
167161
assertEquals(CSVParser.TT_TOKEN + ";a;", parser.testNextToken());
168162
assertEquals(CSVParser.TT_TOKEN + ";foo;", parser.testNextToken());
169163
assertEquals(CSVParser.TT_EORECORD + ";b;", parser.testNextToken());
@@ -185,7 +179,6 @@ public void testNextToken5() throws IOException {
185179
"a,\"foo\n\",b\n\"foo\n baar ,,,\"\n\"\n\t \n\"";
186180
TestCSVParser parser = new TestCSVParser(new StringReader(code));
187181
parser.setStrategy(CSVStrategy.DEFAULT_STRATEGY);
188-
System.out.println("---------\n" + code + "\n-------------");
189182
assertEquals(CSVParser.TT_TOKEN + ";a;", parser.testNextToken());
190183
assertEquals(CSVParser.TT_TOKEN + ";foo\n;", parser.testNextToken());
191184
assertEquals(CSVParser.TT_EORECORD + ";b;", parser.testNextToken());
@@ -205,7 +198,6 @@ public void testNextToken6() throws IOException {
205198
String code = "a;'b and '' more\n'\n!comment;;;;\n;;";
206199
TestCSVParser parser = new TestCSVParser(new StringReader(code));
207200
parser.setStrategy( new CSVStrategy(';', '\'', '!') );
208-
System.out.println("---------\n" + code + "\n-------------");
209201
assertEquals(CSVParser.TT_TOKEN + ";a;", parser.testNextToken());
210202
assertEquals(
211203
CSVParser.TT_EORECORD + ";b and ' more\n;",
@@ -231,7 +223,6 @@ public void testNextToken6() throws IOException {
231223
};
232224
public void testGetLine() throws IOException {
233225
CSVParser parser = new CSVParser(new StringReader(code));
234-
System.out.println("---------\n" + code + "\n-------------");
235226
String[] tmp = null;
236227
for (int i = 0; i < res.length; i++) {
237228
tmp = parser.getLine();
@@ -243,7 +234,6 @@ public void testGetLine() throws IOException {
243234

244235
public void testNextValue() throws IOException {
245236
CSVParser parser = new CSVParser(new StringReader(code));
246-
System.out.println("---------\n" + code + "\n-------------");
247237
String tmp = null;
248238
for (int i = 0; i < res.length; i++) {
249239
for (int j = 0; j < res[i].length; j++) {
@@ -257,7 +247,6 @@ public void testNextValue() throws IOException {
257247

258248
public void testGetAllValues() throws IOException {
259249
CSVParser parser = new CSVParser(new StringReader(code));
260-
System.out.println("---------\n" + code + "\n-------------");
261250
String[][] tmp = parser.getAllValues();
262251
assertEquals(res.length, tmp.length);
263252
assertTrue(tmp.length > 0);
@@ -278,7 +267,6 @@ public void testExcelStrategy1() throws IOException {
278267
{"\"hello\"", " \"world\"", "abc\ndef", ""}
279268
};
280269
CSVParser parser = new CSVParser(new StringReader(code), CSVStrategy.EXCEL_STRATEGY);
281-
System.out.println("---------\n" + code + "\n-------------");
282270
String[][] tmp = parser.getAllValues();
283271
assertEquals(res.length, tmp.length);
284272
assertTrue(tmp.length > 0);
@@ -298,14 +286,10 @@ public void testExcelStrategy2() throws Exception {
298286
};
299287
CSVParser parser = new CSVParser(new StringReader(code));
300288
parser.setStrategy(CSVStrategy.EXCEL_STRATEGY);
301-
System.out.println("---------\n" + code + "\n-------------");
302289
String[][] tmp = parser.getAllValues();
303290
assertEquals(res.length, tmp.length);
304291
assertTrue(tmp.length > 0);
305292
for (int i = 0; i < res.length; i++) {
306-
for (int j = 0; j < tmp[i].length; j++) {
307-
System.out.println("'" + tmp[i][j] + "'");
308-
}
309293
assertTrue(Arrays.equals(res[i], tmp[i]));
310294
}
311295
}
@@ -331,14 +315,10 @@ public void testEndOfFileBehaviourExcel() throws Exception {
331315
code = codes[codeIndex];
332316
CSVParser parser = new CSVParser(new StringReader(code));
333317
parser.setStrategy(CSVStrategy.EXCEL_STRATEGY);
334-
System.out.println("---------\n" + code + "\n-------------");
335318
String[][] tmp = parser.getAllValues();
336319
assertEquals(res.length, tmp.length);
337320
assertTrue(tmp.length > 0);
338321
for (int i = 0; i < res.length; i++) {
339-
for (int j = 0; j < tmp[i].length; j++) {
340-
System.out.println("'" + tmp[i][j] + "'");
341-
}
342322
assertTrue(Arrays.equals(res[i], tmp[i]));
343323
}
344324
}
@@ -364,14 +344,10 @@ public void testEndOfFileBehaviorCSV() throws Exception {
364344
code = codes[codeIndex];
365345
CSVParser parser = new CSVParser(new StringReader(code));
366346
parser.setStrategy(CSVStrategy.DEFAULT_STRATEGY);
367-
System.out.println("---------\n" + code + "\n-------------");
368347
String[][] tmp = parser.getAllValues();
369348
assertEquals(res.length, tmp.length);
370349
assertTrue(tmp.length > 0);
371350
for (int i = 0; i < res.length; i++) {
372-
for (int j = 0; j < tmp[i].length; j++) {
373-
System.out.println("'" + tmp[i][j] + "'");
374-
}
375351
assertTrue(Arrays.equals(res[i], tmp[i]));
376352
}
377353
}
@@ -394,14 +370,10 @@ public void testEmptyLineBehaviourExcel() throws Exception {
394370
code = codes[codeIndex];
395371
CSVParser parser = new CSVParser(new StringReader(code));
396372
parser.setStrategy(CSVStrategy.EXCEL_STRATEGY);
397-
System.out.println("---------\n" + code + "\n-------------");
398373
String[][] tmp = parser.getAllValues();
399374
assertEquals(res.length, tmp.length);
400375
assertTrue(tmp.length > 0);
401376
for (int i = 0; i < res.length; i++) {
402-
for (int j = 0; j < tmp[i].length; j++) {
403-
System.out.println("'" + tmp[i][j] + "'");
404-
}
405377
assertTrue(Arrays.equals(res[i], tmp[i]));
406378
}
407379
}
@@ -422,14 +394,10 @@ public void testEmptyLineBehaviourCSV() throws Exception {
422394
code = codes[codeIndex];
423395
CSVParser parser = new CSVParser(new StringReader(code));
424396
parser.setStrategy(CSVStrategy.DEFAULT_STRATEGY);
425-
System.out.println("---------\n" + code + "\n-------------");
426397
String[][] tmp = parser.getAllValues();
427398
assertEquals(res.length, tmp.length);
428399
assertTrue(tmp.length > 0);
429400
for (int i = 0; i < res.length; i++) {
430-
for (int j = 0; j < tmp[i].length; j++) {
431-
System.out.println("'" + tmp[i][j] + "'");
432-
}
433401
assertTrue(Arrays.equals(res[i], tmp[i]));
434402
}
435403
}
@@ -458,14 +426,10 @@ public void OLDtestBackslashEscaping() throws IOException {
458426
{ "a\\\\,b" } // backslash in quotes only escapes a delimiter (",")
459427
};
460428
CSVParser parser = new CSVParser(new StringReader(code));
461-
System.out.println("---------\n" + code + "\n-------------");
462429
String[][] tmp = parser.getAllValues();
463430
assertEquals(res.length, tmp.length);
464431
assertTrue(tmp.length > 0);
465432
for (int i = 0; i < res.length; i++) {
466-
for (int j = 0; j < tmp[i].length; j++) {
467-
System.out.println("'" + tmp[i][j] + "'");
468-
}
469433
assertTrue(Arrays.equals(res[i], tmp[i]));
470434
}
471435
}
@@ -505,13 +469,9 @@ public void testBackslashEscaping() throws IOException {
505469
CSVStrategy strategy = new CSVStrategy(',','\'',CSVStrategy.COMMENTS_DISABLED,'/',false,false,true,true);
506470

507471
CSVParser parser = new CSVParser(new StringReader(code), strategy);
508-
System.out.println("---------\n" + code + "\n-------------");
509472
String[][] tmp = parser.getAllValues();
510473
assertTrue(tmp.length > 0);
511474
for (int i = 0; i < res.length; i++) {
512-
for (int j = 0; j < tmp[i].length; j++) {
513-
System.out.println("'" + tmp[i][j] + "' should be '" + res[i][j] + "'");
514-
}
515475
assertTrue(Arrays.equals(res[i], tmp[i]));
516476
}
517477
}
@@ -521,7 +481,6 @@ public void testBackslashEscaping() throws IOException {
521481
public void testUnicodeEscape() throws IOException {
522482
String code = "abc,\\u0070\\u0075\\u0062\\u006C\\u0069\\u0063";
523483
CSVParser parser = new CSVParser(new StringReader(code));
524-
System.out.println("---------\n" + code + "\n-------------");
525484
parser.getStrategy().setUnicodeEscapeInterpretation(true);
526485
String[] data = parser.getLine();
527486
assertEquals(2, data.length);
@@ -532,7 +491,6 @@ public void testUnicodeEscape() throws IOException {
532491
public void testCarriageReturnLineFeedEndings() throws IOException {
533492
String code = "foo\r\nbaar,\r\nhello,world\r\n,kanu";
534493
CSVParser parser = new CSVParser(new StringReader(code));
535-
System.out.println("---------\n" + code + "\n-------------");
536494
String[][] data = parser.getAllValues();
537495
assertEquals(4, data.length);
538496
}
@@ -542,24 +500,13 @@ public void testIgnoreEmptyLines() throws IOException {
542500
//String code = "world\r\n\n";
543501
//String code = "foo;baar\r\n\r\nhello;\r\n\r\nworld;\r\n";
544502
CSVParser parser = new CSVParser(new StringReader(code));
545-
System.out.println("---------\n" + code + "\n-------------");
546503
String[][] data = parser.getAllValues();
547-
// for (int i = 0; i < data.length; i++) {
548-
// if (i > 0) {
549-
// System.out.print('\n');
550-
// }
551-
// for (int j = 0; j < data[i].length; j++) {
552-
// System.out.print("(" + j + ")'" + data[i][j] + "'");
553-
// }
554-
// }
555-
// System.out.println("----------");
556504
assertEquals(3, data.length);
557505
}
558506

559507
public void testLineTokenConsistency() throws IOException {
560508
String code = "\nfoo,baar\n\r\n,\n\n,world\r\n\n";
561509
CSVParser parser = new CSVParser(new StringReader(code));
562-
System.out.println("---------\n" + code + "\n-------------");
563510
String[][] data = parser.getAllValues();
564511
parser = new CSVParser(new StringReader(code));
565512
CSVParser parser1 = new CSVParser(new StringReader(code));
@@ -576,7 +523,6 @@ public void testDelimiterIsWhitespace() throws IOException {
576523
String code = "one\ttwo\t\tfour \t five\t six";
577524
TestCSVParser parser = new TestCSVParser(new StringReader(code));
578525
parser.setStrategy(CSVStrategy.TDF_STRATEGY);
579-
System.out.println("---------\n" + code + "\n-------------");
580526
assertEquals(CSVParser.TT_TOKEN + ";one;", parser.testNextToken());
581527
assertEquals(CSVParser.TT_TOKEN + ";two;", parser.testNextToken());
582528
assertEquals(CSVParser.TT_TOKEN + ";;", parser.testNextToken());

0 commit comments

Comments
 (0)