19
19
import java .io .IOException ;
20
20
import java .io .StringReader ;
21
21
22
+ import org .junit .Before ;
23
+ import org .junit .Test ;
24
+
22
25
import junit .framework .TestCase ;
23
26
24
27
public class CSVReaderTest extends TestCase {
@@ -29,6 +32,7 @@ public class CSVReaderTest extends TestCase {
29
32
/**
30
33
* Setup the test.
31
34
*/
35
+ @ Before
32
36
protected void setUp () throws Exception {
33
37
StringBuilder sb = new StringBuilder (CSVReader .INITIAL_READ_SIZE );
34
38
sb .append ("a,b,c" ).append ("\n " ); // standard case
@@ -48,6 +52,7 @@ protected void setUp() throws Exception {
48
52
* @throws IOException
49
53
* if the reader fails.
50
54
*/
55
+ @ Test
51
56
public void testParseLine () throws IOException {
52
57
53
58
// test normal case
@@ -92,6 +97,7 @@ public void testParseLine() throws IOException {
92
97
* @throws IOException
93
98
* if the reader fails.
94
99
*/
100
+ @ Test
95
101
public void testParseAll () throws IOException {
96
102
assertEquals (7 , csvr .readAll ().size ());
97
103
}
@@ -101,6 +107,7 @@ public void testParseAll() throws IOException {
101
107
*
102
108
* @throws IOException if the reader fails.
103
109
*/
110
+ @ Test
104
111
public void testOptionalConstructors () throws IOException {
105
112
106
113
StringBuilder sb = new StringBuilder (CSVReader .INITIAL_READ_SIZE );
@@ -122,6 +129,7 @@ public void testOptionalConstructors() throws IOException {
122
129
*
123
130
* @throws IOException if bad things happen
124
131
*/
132
+ @ Test
125
133
public void testSkippingLines () throws IOException {
126
134
127
135
StringBuilder sb = new StringBuilder (CSVReader .INITIAL_READ_SIZE );
@@ -141,6 +149,7 @@ public void testSkippingLines() throws IOException {
141
149
*
142
150
* @throws IOException if bad things happen
143
151
*/
152
+ @ Test
144
153
public void testParsedLineWithInternalQuota () throws IOException {
145
154
146
155
StringBuilder sb = new StringBuilder (CSVReader .INITIAL_READ_SIZE );
@@ -160,6 +169,7 @@ public void testParsedLineWithInternalQuota() throws IOException {
160
169
* Test a normal non quoted line with three elements
161
170
* @throws IOException
162
171
*/
172
+ @ Test
163
173
public void testNormalParsedLine () throws IOException {
164
174
165
175
StringBuilder sb = new StringBuilder (CSVReader .INITIAL_READ_SIZE );
@@ -181,6 +191,7 @@ public void testNormalParsedLine() throws IOException {
181
191
* Test a line where one of the elements is a single Double quote "
182
192
* @throws IOException
183
193
*/
194
+ @ Test
184
195
public void testADoubleQuoteAsDataElement () throws IOException {
185
196
186
197
StringBuilder sb = new StringBuilder (CSVReader .INITIAL_READ_SIZE );
@@ -203,6 +214,7 @@ public void testADoubleQuoteAsDataElement() throws IOException {
203
214
* Test a line where one of the elements is a single Double quote "
204
215
* @throws IOException
205
216
*/
217
+ @ Test
206
218
public void testEscapedDoubleQuoteAsDataElement () throws IOException {
207
219
208
220
StringBuilder sb = new StringBuilder (CSVReader .INITIAL_READ_SIZE );
@@ -226,6 +238,7 @@ public void testEscapedDoubleQuoteAsDataElement() throws IOException {
226
238
* single quote.
227
239
* @throws IOException
228
240
*/
241
+ @ Test
229
242
public void testASingleQuoteAsDataElement () throws IOException {
230
243
231
244
StringBuilder sb = new StringBuilder (CSVReader .INITIAL_READ_SIZE );
@@ -249,6 +262,7 @@ public void testASingleQuoteAsDataElement() throws IOException {
249
262
* single quote. Also the middle field is empty.
250
263
* @throws IOException
251
264
*/
265
+ @ Test
252
266
public void testASingleQuoteAsDataElementWithEmptyField () throws IOException {
253
267
254
268
StringBuilder sb = new StringBuilder (CSVReader .INITIAL_READ_SIZE );
@@ -274,6 +288,7 @@ public void testASingleQuoteAsDataElementWithEmptyField() throws IOException {
274
288
* @throws IOException
275
289
*
276
290
*/
291
+ @ Test
277
292
public void testIssue2263439 () throws IOException {
278
293
279
294
StringBuilder sb = new StringBuilder (CSVReader .INITIAL_READ_SIZE );
@@ -294,6 +309,7 @@ public void testIssue2263439() throws IOException {
294
309
295
310
}
296
311
312
+ @ Test
297
313
public void testEscapedQuote () throws IOException {
298
314
299
315
StringBuffer sb = new StringBuffer ();
@@ -309,6 +325,7 @@ public void testEscapedQuote() throws IOException {
309
325
310
326
}
311
327
328
+ @ Test
312
329
public void testEscapedEscape () throws IOException {
313
330
314
331
StringBuffer sb = new StringBuffer ();
@@ -331,6 +348,7 @@ public void testEscapedEscape() throws IOException {
331
348
* single quotes.
332
349
* @throws IOException
333
350
*/
351
+ @ Test
334
352
public void testSingleQuoteWhenDoubleQuoteIsQuoteChar () throws IOException {
335
353
336
354
StringBuilder sb = new StringBuilder (CSVReader .INITIAL_READ_SIZE );
@@ -353,6 +371,7 @@ public void testSingleQuoteWhenDoubleQuoteIsQuoteChar() throws IOException {
353
371
* Test a normal line with three elements and all elements are quoted
354
372
* @throws IOException
355
373
*/
374
+ @ Test
356
375
public void testQuotedParsedLine () throws IOException {
357
376
358
377
StringBuilder sb = new StringBuilder (CSVReader .INITIAL_READ_SIZE );
@@ -380,7 +399,7 @@ public void testQuotedParsedLine() throws IOException {
380
399
* "804503689","London",""London""shop","address","116.453182","39.918884"
381
400
* "453074125","NewYork","brief","address"","121.514683","31.228511"
382
401
*/
383
-
402
+ @ Test
384
403
public void testIssue2726363 ()throws IOException {
385
404
386
405
StringBuilder sb = new StringBuilder (CSVReader .INITIAL_READ_SIZE );
0 commit comments