commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r856056 [21/26] - in /websites/production/commons/content/proper/commons-csv: ./ apidocs/ apidocs/org/apache/commons/csv/ apidocs/org/apache/commons/csv/class-use/ apidocs/src-html/org/apache/commons/csv/ cobertura/ testapidocs/ testapidocs...
Date Tue, 26 Mar 2013 22:16:20 GMT
Modified: websites/production/commons/content/proper/commons-csv/xref-test/org/apache/commons/csv/CSVParserTest.html
==============================================================================
--- websites/production/commons/content/proper/commons-csv/xref-test/org/apache/commons/csv/CSVParserTest.html (original)
+++ websites/production/commons/content/proper/commons-csv/xref-test/org/apache/commons/csv/CSVParserTest.html Tue Mar 26 22:16:19 2013
@@ -61,8 +61,8 @@
 <a class="jxr_linenumber" name="51" href="#51">51</a>  <em class="jxr_javadoccomment"> * section. In case a test fails, you should follow a top-down approach for</em>
 <a class="jxr_linenumber" name="52" href="#52">52</a>  <em class="jxr_javadoccomment"> * fixing a potential bug (its likely that the parser itself fails if the lexer</em>
 <a class="jxr_linenumber" name="53" href="#53">53</a>  <em class="jxr_javadoccomment"> * has problems...).</em>
-<a class="jxr_linenumber" name="54" href="#54">54</a>  <em class="jxr_javadoccomment"> * </em>
-<a class="jxr_linenumber" name="55" href="#55">55</a>  <em class="jxr_javadoccomment"> * @version $Id: CSVParserTest.java 1437517 2013-01-23 16:00:03Z ggregory $</em>
+<a class="jxr_linenumber" name="54" href="#54">54</a>  <em class="jxr_javadoccomment"> *</em>
+<a class="jxr_linenumber" name="55" href="#55">55</a>  <em class="jxr_javadoccomment"> * @version $Id: CSVParserTest.java 1461202 2013-03-26 16:19:48Z ggregory $</em>
 <a class="jxr_linenumber" name="56" href="#56">56</a>  <em class="jxr_javadoccomment"> */</em>
 <a class="jxr_linenumber" name="57" href="#57">57</a>  <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../org/apache/commons/csv/CSVParserTest.html">CSVParserTest</a> {
 <a class="jxr_linenumber" name="58" href="#58">58</a>  
@@ -328,135 +328,135 @@
 <a class="jxr_linenumber" name="318" href="#318">318</a>         <strong class="jxr_keyword">final</strong> CSVParser parser = <strong class="jxr_keyword">new</strong> CSVParser(code, format);
 <a class="jxr_linenumber" name="319" href="#319">319</a>         <strong class="jxr_keyword">final</strong> List&lt;CSVRecord&gt; records = parser.getRecords();
 <a class="jxr_linenumber" name="320" href="#320">320</a>         assertTrue(records.size() &gt; 0);
-<a class="jxr_linenumber" name="321" href="#321">321</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; res.length; i++) {
-<a class="jxr_linenumber" name="322" href="#322">322</a>             assertArrayEquals(res[i], records.get(i).values());
-<a class="jxr_linenumber" name="323" href="#323">323</a>         }
-<a class="jxr_linenumber" name="324" href="#324">324</a>     }
-<a class="jxr_linenumber" name="325" href="#325">325</a> 
-<a class="jxr_linenumber" name="326" href="#326">326</a>     @Test
-<a class="jxr_linenumber" name="327" href="#327">327</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testBackslashEscaping2() <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="328" href="#328">328</a> 
-<a class="jxr_linenumber" name="329" href="#329">329</a>         <em class="jxr_comment">// To avoid confusion over the need for escaping chars in java code,</em>
-<a class="jxr_linenumber" name="330" href="#330">330</a>         <em class="jxr_comment">// We will test with a forward slash as the escape char, and a single</em>
-<a class="jxr_linenumber" name="331" href="#331">331</a>         <em class="jxr_comment">// quote as the encapsulator.</em>
-<a class="jxr_linenumber" name="332" href="#332">332</a> 
-<a class="jxr_linenumber" name="333" href="#333">333</a>         <strong class="jxr_keyword">final</strong> String code = <span class="jxr_string">""</span>
-<a class="jxr_linenumber" name="334" href="#334">334</a>                 + <span class="jxr_string">" , , \n"</span>           <em class="jxr_comment">// 1)</em>
-<a class="jxr_linenumber" name="335" href="#335">335</a>                 + <span class="jxr_string">" \t ,  , \n"</span>       <em class="jxr_comment">// 2)</em>
-<a class="jxr_linenumber" name="336" href="#336">336</a>                 + <span class="jxr_string">" // , /, , /,\n"</span>   // 3)
-<a class="jxr_linenumber" name="337" href="#337">337</a>                 + <span class="jxr_string">""</span>;
-<a class="jxr_linenumber" name="338" href="#338">338</a>         <strong class="jxr_keyword">final</strong> String[][] res = {
-<a class="jxr_linenumber" name="339" href="#339">339</a>                 {<span class="jxr_string">" "</span>, <span class="jxr_string">" "</span>, <span class="jxr_string">" "</span>},         <em class="jxr_comment">// 1</em>
-<a class="jxr_linenumber" name="340" href="#340">340</a>                 {<span class="jxr_string">" \t "</span>, <span class="jxr_string">"  "</span>, <span class="jxr_string">" "</span>},     <em class="jxr_comment">// 2</em>
-<a class="jxr_linenumber" name="341" href="#341">341</a>                 {<span class="jxr_string">" / "</span>, <span class="jxr_string">" , "</span>, <span class="jxr_string">" ,"</span>},    <em class="jxr_comment">// 3</em>
-<a class="jxr_linenumber" name="342" href="#342">342</a>         };
+<a class="jxr_linenumber" name="321" href="#321">321</a> 
+<a class="jxr_linenumber" name="322" href="#322">322</a>         Utils.compare(<span class="jxr_string">"Records do not match expected result"</span>, res, records);
+<a class="jxr_linenumber" name="323" href="#323">323</a>     }
+<a class="jxr_linenumber" name="324" href="#324">324</a> 
+<a class="jxr_linenumber" name="325" href="#325">325</a>     @Test
+<a class="jxr_linenumber" name="326" href="#326">326</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testBackslashEscaping2() <strong class="jxr_keyword">throws</strong> IOException {
+<a class="jxr_linenumber" name="327" href="#327">327</a> 
+<a class="jxr_linenumber" name="328" href="#328">328</a>         <em class="jxr_comment">// To avoid confusion over the need for escaping chars in java code,</em>
+<a class="jxr_linenumber" name="329" href="#329">329</a>         <em class="jxr_comment">// We will test with a forward slash as the escape char, and a single</em>
+<a class="jxr_linenumber" name="330" href="#330">330</a>         <em class="jxr_comment">// quote as the encapsulator.</em>
+<a class="jxr_linenumber" name="331" href="#331">331</a> 
+<a class="jxr_linenumber" name="332" href="#332">332</a>         <strong class="jxr_keyword">final</strong> String code = <span class="jxr_string">""</span>
+<a class="jxr_linenumber" name="333" href="#333">333</a>                 + <span class="jxr_string">" , , \n"</span>           <em class="jxr_comment">// 1)</em>
+<a class="jxr_linenumber" name="334" href="#334">334</a>                 + <span class="jxr_string">" \t ,  , \n"</span>       <em class="jxr_comment">// 2)</em>
+<a class="jxr_linenumber" name="335" href="#335">335</a>                 + <span class="jxr_string">" // , /, , /,\n"</span>   // 3)
+<a class="jxr_linenumber" name="336" href="#336">336</a>                 + <span class="jxr_string">""</span>;
+<a class="jxr_linenumber" name="337" href="#337">337</a>         <strong class="jxr_keyword">final</strong> String[][] res = {
+<a class="jxr_linenumber" name="338" href="#338">338</a>                 {<span class="jxr_string">" "</span>, <span class="jxr_string">" "</span>, <span class="jxr_string">" "</span>},         <em class="jxr_comment">// 1</em>
+<a class="jxr_linenumber" name="339" href="#339">339</a>                 {<span class="jxr_string">" \t "</span>, <span class="jxr_string">"  "</span>, <span class="jxr_string">" "</span>},     <em class="jxr_comment">// 2</em>
+<a class="jxr_linenumber" name="340" href="#340">340</a>                 {<span class="jxr_string">" / "</span>, <span class="jxr_string">" , "</span>, <span class="jxr_string">" ,"</span>},    <em class="jxr_comment">// 3</em>
+<a class="jxr_linenumber" name="341" href="#341">341</a>         };
+<a class="jxr_linenumber" name="342" href="#342">342</a> 
 <a class="jxr_linenumber" name="343" href="#343">343</a> 
-<a class="jxr_linenumber" name="344" href="#344">344</a> 
-<a class="jxr_linenumber" name="345" href="#345">345</a>         <strong class="jxr_keyword">final</strong> CSVFormat format = CSVFormat.newBuilder(',').withEscape('/')
-<a class="jxr_linenumber" name="346" href="#346">346</a>                 .withIgnoreEmptyLines(<strong class="jxr_keyword">true</strong>).withRecordSeparator(CRLF).build();
-<a class="jxr_linenumber" name="347" href="#347">347</a> 
-<a class="jxr_linenumber" name="348" href="#348">348</a>         <strong class="jxr_keyword">final</strong> CSVParser parser = <strong class="jxr_keyword">new</strong> CSVParser(code, format);
-<a class="jxr_linenumber" name="349" href="#349">349</a>         <strong class="jxr_keyword">final</strong> List&lt;CSVRecord&gt; records = parser.getRecords();
-<a class="jxr_linenumber" name="350" href="#350">350</a>         assertTrue(records.size() &gt; 0);
-<a class="jxr_linenumber" name="351" href="#351">351</a> 
-<a class="jxr_linenumber" name="352" href="#352">352</a>         Utils.compare(<span class="jxr_string">""</span>, res, records);
-<a class="jxr_linenumber" name="353" href="#353">353</a>     }
-<a class="jxr_linenumber" name="354" href="#354">354</a> 
-<a class="jxr_linenumber" name="355" href="#355">355</a>     @Test
-<a class="jxr_linenumber" name="356" href="#356">356</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testDefaultFormat() <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="357" href="#357">357</a>         <strong class="jxr_keyword">final</strong> String code = <span class="jxr_string">""</span>
-<a class="jxr_linenumber" name="358" href="#358">358</a>                 + <span class="jxr_string">"a,b#\n"</span>           <em class="jxr_comment">// 1)</em>
-<a class="jxr_linenumber" name="359" href="#359">359</a>                 + <span class="jxr_string">"\&quot;\n\&quot;,\&quot; \&quot;,#\n"</span>   <em class="jxr_comment">// 2)</em>
-<a class="jxr_linenumber" name="360" href="#360">360</a>                 + <span class="jxr_string">"#,\&quot;\&quot;\n"</span>         <em class="jxr_comment">// 3)</em>
-<a class="jxr_linenumber" name="361" href="#361">361</a>                 + <span class="jxr_string">"# Final comment\n"</span><em class="jxr_comment">// 4)</em>
-<a class="jxr_linenumber" name="362" href="#362">362</a>                 ;
-<a class="jxr_linenumber" name="363" href="#363">363</a>         <strong class="jxr_keyword">final</strong> String[][] res = {
-<a class="jxr_linenumber" name="364" href="#364">364</a>                 {<span class="jxr_string">"a"</span>, <span class="jxr_string">"b#"</span>},
-<a class="jxr_linenumber" name="365" href="#365">365</a>                 {<span class="jxr_string">"\n"</span>, <span class="jxr_string">" "</span>, <span class="jxr_string">"#"</span>},
-<a class="jxr_linenumber" name="366" href="#366">366</a>                 {<span class="jxr_string">"#"</span>, <span class="jxr_string">""</span>},
-<a class="jxr_linenumber" name="367" href="#367">367</a>                 {<span class="jxr_string">"# Final comment"</span>}
-<a class="jxr_linenumber" name="368" href="#368">368</a>         };
-<a class="jxr_linenumber" name="369" href="#369">369</a> 
-<a class="jxr_linenumber" name="370" href="#370">370</a>         CSVFormat format = CSVFormat.DEFAULT;
-<a class="jxr_linenumber" name="371" href="#371">371</a>         assertFalse(format.isCommentingEnabled());
-<a class="jxr_linenumber" name="372" href="#372">372</a> 
-<a class="jxr_linenumber" name="373" href="#373">373</a>         CSVParser parser = <strong class="jxr_keyword">new</strong> CSVParser(code, format);
-<a class="jxr_linenumber" name="374" href="#374">374</a>         List&lt;CSVRecord&gt; records = parser.getRecords();
-<a class="jxr_linenumber" name="375" href="#375">375</a>         assertTrue(records.size() &gt; 0);
-<a class="jxr_linenumber" name="376" href="#376">376</a> 
-<a class="jxr_linenumber" name="377" href="#377">377</a>         Utils.compare(<span class="jxr_string">"Failed to parse without comments"</span>, res, records);
-<a class="jxr_linenumber" name="378" href="#378">378</a> 
-<a class="jxr_linenumber" name="379" href="#379">379</a>         <strong class="jxr_keyword">final</strong> String[][] res_comments = {
-<a class="jxr_linenumber" name="380" href="#380">380</a>                 {<span class="jxr_string">"a"</span>, <span class="jxr_string">"b#"</span>},
-<a class="jxr_linenumber" name="381" href="#381">381</a>                 {<span class="jxr_string">"\n"</span>, <span class="jxr_string">" "</span>, <span class="jxr_string">"#"</span>},
-<a class="jxr_linenumber" name="382" href="#382">382</a>         };
-<a class="jxr_linenumber" name="383" href="#383">383</a> 
-<a class="jxr_linenumber" name="384" href="#384">384</a>         format = CSVFormat.newBuilder().withCommentStart('#').build();
-<a class="jxr_linenumber" name="385" href="#385">385</a>         parser = <strong class="jxr_keyword">new</strong> CSVParser(code, format);
-<a class="jxr_linenumber" name="386" href="#386">386</a>         records = parser.getRecords();
-<a class="jxr_linenumber" name="387" href="#387">387</a> 
-<a class="jxr_linenumber" name="388" href="#388">388</a>         Utils.compare(<span class="jxr_string">"Failed to parse with comments"</span>, res_comments, records);
-<a class="jxr_linenumber" name="389" href="#389">389</a>     }
-<a class="jxr_linenumber" name="390" href="#390">390</a> 
-<a class="jxr_linenumber" name="391" href="#391">391</a>     @Test
-<a class="jxr_linenumber" name="392" href="#392">392</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testCarriageReturnLineFeedEndings() <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="393" href="#393">393</a>         <strong class="jxr_keyword">final</strong> String code = <span class="jxr_string">"foo\r\nbaar,\r\nhello,world\r\n,kanu"</span>;
-<a class="jxr_linenumber" name="394" href="#394">394</a>         <strong class="jxr_keyword">final</strong> CSVParser parser = <strong class="jxr_keyword">new</strong> CSVParser(<strong class="jxr_keyword">new</strong> StringReader(code));
-<a class="jxr_linenumber" name="395" href="#395">395</a>         <strong class="jxr_keyword">final</strong> List&lt;CSVRecord&gt; records = parser.getRecords();
-<a class="jxr_linenumber" name="396" href="#396">396</a>         assertEquals(4, records.size());
-<a class="jxr_linenumber" name="397" href="#397">397</a>     }
-<a class="jxr_linenumber" name="398" href="#398">398</a> 
-<a class="jxr_linenumber" name="399" href="#399">399</a>     @Test
-<a class="jxr_linenumber" name="400" href="#400">400</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testCarriageReturnEndings() <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="401" href="#401">401</a>         <strong class="jxr_keyword">final</strong> String code = <span class="jxr_string">"foo\rbaar,\rhello,world\r,kanu"</span>;
-<a class="jxr_linenumber" name="402" href="#402">402</a>         <strong class="jxr_keyword">final</strong> CSVParser parser = <strong class="jxr_keyword">new</strong> CSVParser(<strong class="jxr_keyword">new</strong> StringReader(code));
-<a class="jxr_linenumber" name="403" href="#403">403</a>         <strong class="jxr_keyword">final</strong> List&lt;CSVRecord&gt; records = parser.getRecords();
-<a class="jxr_linenumber" name="404" href="#404">404</a>         assertEquals(4, records.size());
-<a class="jxr_linenumber" name="405" href="#405">405</a>     }
-<a class="jxr_linenumber" name="406" href="#406">406</a> 
-<a class="jxr_linenumber" name="407" href="#407">407</a>     @Test
-<a class="jxr_linenumber" name="408" href="#408">408</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testLineFeedEndings() <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="409" href="#409">409</a>         <strong class="jxr_keyword">final</strong> String code = <span class="jxr_string">"foo\nbaar,\nhello,world\n,kanu"</span>;
-<a class="jxr_linenumber" name="410" href="#410">410</a>         <strong class="jxr_keyword">final</strong> CSVParser parser = <strong class="jxr_keyword">new</strong> CSVParser(<strong class="jxr_keyword">new</strong> StringReader(code));
-<a class="jxr_linenumber" name="411" href="#411">411</a>         <strong class="jxr_keyword">final</strong> List&lt;CSVRecord&gt; records = parser.getRecords();
-<a class="jxr_linenumber" name="412" href="#412">412</a>         assertEquals(4, records.size());
-<a class="jxr_linenumber" name="413" href="#413">413</a>     }
-<a class="jxr_linenumber" name="414" href="#414">414</a> 
-<a class="jxr_linenumber" name="415" href="#415">415</a>     @Test
-<a class="jxr_linenumber" name="416" href="#416">416</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testIgnoreEmptyLines() <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="417" href="#417">417</a>         <strong class="jxr_keyword">final</strong> String code = <span class="jxr_string">"\nfoo,baar\n\r\n,\n\n,world\r\n\n"</span>;
-<a class="jxr_linenumber" name="418" href="#418">418</a>         <em class="jxr_comment">//String code = "world\r\n\n";</em>
-<a class="jxr_linenumber" name="419" href="#419">419</a>         <em class="jxr_comment">//String code = "foo;baar\r\n\r\nhello;\r\n\r\nworld;\r\n";</em>
-<a class="jxr_linenumber" name="420" href="#420">420</a>         <strong class="jxr_keyword">final</strong> CSVParser parser = <strong class="jxr_keyword">new</strong> CSVParser(<strong class="jxr_keyword">new</strong> StringReader(code));
-<a class="jxr_linenumber" name="421" href="#421">421</a>         <strong class="jxr_keyword">final</strong> List&lt;CSVRecord&gt; records = parser.getRecords();
-<a class="jxr_linenumber" name="422" href="#422">422</a>         assertEquals(3, records.size());
-<a class="jxr_linenumber" name="423" href="#423">423</a>     }
-<a class="jxr_linenumber" name="424" href="#424">424</a> 
-<a class="jxr_linenumber" name="425" href="#425">425</a>     @Test
-<a class="jxr_linenumber" name="426" href="#426">426</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testForEach() <strong class="jxr_keyword">throws</strong> Exception {
-<a class="jxr_linenumber" name="427" href="#427">427</a>         <strong class="jxr_keyword">final</strong> List&lt;CSVRecord&gt; records = <strong class="jxr_keyword">new</strong> ArrayList&lt;CSVRecord&gt;();
-<a class="jxr_linenumber" name="428" href="#428">428</a> 
-<a class="jxr_linenumber" name="429" href="#429">429</a>         <strong class="jxr_keyword">final</strong> Reader in = <strong class="jxr_keyword">new</strong> StringReader(<span class="jxr_string">"a,b,c\n1,2,3\nx,y,z"</span>);
-<a class="jxr_linenumber" name="430" href="#430">430</a> 
-<a class="jxr_linenumber" name="431" href="#431">431</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">final</strong> CSVRecord record : CSVFormat.DEFAULT.parse(in)) {
-<a class="jxr_linenumber" name="432" href="#432">432</a>             records.add(record);
-<a class="jxr_linenumber" name="433" href="#433">433</a>         }
-<a class="jxr_linenumber" name="434" href="#434">434</a> 
-<a class="jxr_linenumber" name="435" href="#435">435</a>         assertEquals(3, records.size());
-<a class="jxr_linenumber" name="436" href="#436">436</a>         assertArrayEquals(<strong class="jxr_keyword">new</strong> String[]{<span class="jxr_string">"a"</span>, <span class="jxr_string">"b"</span>, <span class="jxr_string">"c"</span>}, records.get(0).values());
-<a class="jxr_linenumber" name="437" href="#437">437</a>         assertArrayEquals(<strong class="jxr_keyword">new</strong> String[]{<span class="jxr_string">"1"</span>, <span class="jxr_string">"2"</span>, <span class="jxr_string">"3"</span>}, records.get(1).values());
-<a class="jxr_linenumber" name="438" href="#438">438</a>         assertArrayEquals(<strong class="jxr_keyword">new</strong> String[]{<span class="jxr_string">"x"</span>, <span class="jxr_string">"y"</span>, <span class="jxr_string">"z"</span>}, records.get(2).values());
-<a class="jxr_linenumber" name="439" href="#439">439</a>     }
-<a class="jxr_linenumber" name="440" href="#440">440</a> 
-<a class="jxr_linenumber" name="441" href="#441">441</a>     @Test
-<a class="jxr_linenumber" name="442" href="#442">442</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testRoundtrip() <strong class="jxr_keyword">throws</strong> Exception {
-<a class="jxr_linenumber" name="443" href="#443">443</a>         <strong class="jxr_keyword">final</strong> StringWriter out = <strong class="jxr_keyword">new</strong> StringWriter();
-<a class="jxr_linenumber" name="444" href="#444">444</a>         <strong class="jxr_keyword">final</strong> CSVPrinter printer = <strong class="jxr_keyword">new</strong> CSVPrinter(out, CSVFormat.DEFAULT);
-<a class="jxr_linenumber" name="445" href="#445">445</a>         <strong class="jxr_keyword">final</strong> String input = <span class="jxr_string">"a,b,c\r\n1,2,3\r\nx,y,z\r\n"</span>;
-<a class="jxr_linenumber" name="446" href="#446">446</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">final</strong> CSVRecord record : CSVFormat.DEFAULT.parse(<strong class="jxr_keyword">new</strong> StringReader(input))) {
-<a class="jxr_linenumber" name="447" href="#447">447</a>             printer.printRecord(record);
-<a class="jxr_linenumber" name="448" href="#448">448</a>         }
-<a class="jxr_linenumber" name="449" href="#449">449</a>         assertEquals(input, out.toString());
+<a class="jxr_linenumber" name="344" href="#344">344</a>         <strong class="jxr_keyword">final</strong> CSVFormat format = CSVFormat.newBuilder(',').withEscape('/')
+<a class="jxr_linenumber" name="345" href="#345">345</a>                 .withIgnoreEmptyLines(<strong class="jxr_keyword">true</strong>).withRecordSeparator(CRLF).build();
+<a class="jxr_linenumber" name="346" href="#346">346</a> 
+<a class="jxr_linenumber" name="347" href="#347">347</a>         <strong class="jxr_keyword">final</strong> CSVParser parser = <strong class="jxr_keyword">new</strong> CSVParser(code, format);
+<a class="jxr_linenumber" name="348" href="#348">348</a>         <strong class="jxr_keyword">final</strong> List&lt;CSVRecord&gt; records = parser.getRecords();
+<a class="jxr_linenumber" name="349" href="#349">349</a>         assertTrue(records.size() &gt; 0);
+<a class="jxr_linenumber" name="350" href="#350">350</a> 
+<a class="jxr_linenumber" name="351" href="#351">351</a>         Utils.compare(<span class="jxr_string">""</span>, res, records);
+<a class="jxr_linenumber" name="352" href="#352">352</a>     }
+<a class="jxr_linenumber" name="353" href="#353">353</a> 
+<a class="jxr_linenumber" name="354" href="#354">354</a>     @Test
+<a class="jxr_linenumber" name="355" href="#355">355</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testDefaultFormat() <strong class="jxr_keyword">throws</strong> IOException {
+<a class="jxr_linenumber" name="356" href="#356">356</a>         <strong class="jxr_keyword">final</strong> String code = <span class="jxr_string">""</span>
+<a class="jxr_linenumber" name="357" href="#357">357</a>                 + <span class="jxr_string">"a,b#\n"</span>           <em class="jxr_comment">// 1)</em>
+<a class="jxr_linenumber" name="358" href="#358">358</a>                 + <span class="jxr_string">"\&quot;\n\&quot;,\&quot; \&quot;,#\n"</span>   <em class="jxr_comment">// 2)</em>
+<a class="jxr_linenumber" name="359" href="#359">359</a>                 + <span class="jxr_string">"#,\&quot;\&quot;\n"</span>         <em class="jxr_comment">// 3)</em>
+<a class="jxr_linenumber" name="360" href="#360">360</a>                 + <span class="jxr_string">"# Final comment\n"</span><em class="jxr_comment">// 4)</em>
+<a class="jxr_linenumber" name="361" href="#361">361</a>                 ;
+<a class="jxr_linenumber" name="362" href="#362">362</a>         <strong class="jxr_keyword">final</strong> String[][] res = {
+<a class="jxr_linenumber" name="363" href="#363">363</a>                 {<span class="jxr_string">"a"</span>, <span class="jxr_string">"b#"</span>},
+<a class="jxr_linenumber" name="364" href="#364">364</a>                 {<span class="jxr_string">"\n"</span>, <span class="jxr_string">" "</span>, <span class="jxr_string">"#"</span>},
+<a class="jxr_linenumber" name="365" href="#365">365</a>                 {<span class="jxr_string">"#"</span>, <span class="jxr_string">""</span>},
+<a class="jxr_linenumber" name="366" href="#366">366</a>                 {<span class="jxr_string">"# Final comment"</span>}
+<a class="jxr_linenumber" name="367" href="#367">367</a>         };
+<a class="jxr_linenumber" name="368" href="#368">368</a> 
+<a class="jxr_linenumber" name="369" href="#369">369</a>         CSVFormat format = CSVFormat.DEFAULT;
+<a class="jxr_linenumber" name="370" href="#370">370</a>         assertFalse(format.isCommentingEnabled());
+<a class="jxr_linenumber" name="371" href="#371">371</a> 
+<a class="jxr_linenumber" name="372" href="#372">372</a>         CSVParser parser = <strong class="jxr_keyword">new</strong> CSVParser(code, format);
+<a class="jxr_linenumber" name="373" href="#373">373</a>         List&lt;CSVRecord&gt; records = parser.getRecords();
+<a class="jxr_linenumber" name="374" href="#374">374</a>         assertTrue(records.size() &gt; 0);
+<a class="jxr_linenumber" name="375" href="#375">375</a> 
+<a class="jxr_linenumber" name="376" href="#376">376</a>         Utils.compare(<span class="jxr_string">"Failed to parse without comments"</span>, res, records);
+<a class="jxr_linenumber" name="377" href="#377">377</a> 
+<a class="jxr_linenumber" name="378" href="#378">378</a>         <strong class="jxr_keyword">final</strong> String[][] res_comments = {
+<a class="jxr_linenumber" name="379" href="#379">379</a>                 {<span class="jxr_string">"a"</span>, <span class="jxr_string">"b#"</span>},
+<a class="jxr_linenumber" name="380" href="#380">380</a>                 {<span class="jxr_string">"\n"</span>, <span class="jxr_string">" "</span>, <span class="jxr_string">"#"</span>},
+<a class="jxr_linenumber" name="381" href="#381">381</a>         };
+<a class="jxr_linenumber" name="382" href="#382">382</a> 
+<a class="jxr_linenumber" name="383" href="#383">383</a>         format = CSVFormat.newBuilder().withCommentStart('#').build();
+<a class="jxr_linenumber" name="384" href="#384">384</a>         parser = <strong class="jxr_keyword">new</strong> CSVParser(code, format);
+<a class="jxr_linenumber" name="385" href="#385">385</a>         records = parser.getRecords();
+<a class="jxr_linenumber" name="386" href="#386">386</a> 
+<a class="jxr_linenumber" name="387" href="#387">387</a>         Utils.compare(<span class="jxr_string">"Failed to parse with comments"</span>, res_comments, records);
+<a class="jxr_linenumber" name="388" href="#388">388</a>     }
+<a class="jxr_linenumber" name="389" href="#389">389</a> 
+<a class="jxr_linenumber" name="390" href="#390">390</a>     @Test
+<a class="jxr_linenumber" name="391" href="#391">391</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testCarriageReturnLineFeedEndings() <strong class="jxr_keyword">throws</strong> IOException {
+<a class="jxr_linenumber" name="392" href="#392">392</a>         <strong class="jxr_keyword">final</strong> String code = <span class="jxr_string">"foo\r\nbaar,\r\nhello,world\r\n,kanu"</span>;
+<a class="jxr_linenumber" name="393" href="#393">393</a>         <strong class="jxr_keyword">final</strong> CSVParser parser = <strong class="jxr_keyword">new</strong> CSVParser(<strong class="jxr_keyword">new</strong> StringReader(code));
+<a class="jxr_linenumber" name="394" href="#394">394</a>         <strong class="jxr_keyword">final</strong> List&lt;CSVRecord&gt; records = parser.getRecords();
+<a class="jxr_linenumber" name="395" href="#395">395</a>         assertEquals(4, records.size());
+<a class="jxr_linenumber" name="396" href="#396">396</a>     }
+<a class="jxr_linenumber" name="397" href="#397">397</a> 
+<a class="jxr_linenumber" name="398" href="#398">398</a>     @Test
+<a class="jxr_linenumber" name="399" href="#399">399</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testCarriageReturnEndings() <strong class="jxr_keyword">throws</strong> IOException {
+<a class="jxr_linenumber" name="400" href="#400">400</a>         <strong class="jxr_keyword">final</strong> String code = <span class="jxr_string">"foo\rbaar,\rhello,world\r,kanu"</span>;
+<a class="jxr_linenumber" name="401" href="#401">401</a>         <strong class="jxr_keyword">final</strong> CSVParser parser = <strong class="jxr_keyword">new</strong> CSVParser(<strong class="jxr_keyword">new</strong> StringReader(code));
+<a class="jxr_linenumber" name="402" href="#402">402</a>         <strong class="jxr_keyword">final</strong> List&lt;CSVRecord&gt; records = parser.getRecords();
+<a class="jxr_linenumber" name="403" href="#403">403</a>         assertEquals(4, records.size());
+<a class="jxr_linenumber" name="404" href="#404">404</a>     }
+<a class="jxr_linenumber" name="405" href="#405">405</a> 
+<a class="jxr_linenumber" name="406" href="#406">406</a>     @Test
+<a class="jxr_linenumber" name="407" href="#407">407</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testLineFeedEndings() <strong class="jxr_keyword">throws</strong> IOException {
+<a class="jxr_linenumber" name="408" href="#408">408</a>         <strong class="jxr_keyword">final</strong> String code = <span class="jxr_string">"foo\nbaar,\nhello,world\n,kanu"</span>;
+<a class="jxr_linenumber" name="409" href="#409">409</a>         <strong class="jxr_keyword">final</strong> CSVParser parser = <strong class="jxr_keyword">new</strong> CSVParser(<strong class="jxr_keyword">new</strong> StringReader(code));
+<a class="jxr_linenumber" name="410" href="#410">410</a>         <strong class="jxr_keyword">final</strong> List&lt;CSVRecord&gt; records = parser.getRecords();
+<a class="jxr_linenumber" name="411" href="#411">411</a>         assertEquals(4, records.size());
+<a class="jxr_linenumber" name="412" href="#412">412</a>     }
+<a class="jxr_linenumber" name="413" href="#413">413</a> 
+<a class="jxr_linenumber" name="414" href="#414">414</a>     @Test
+<a class="jxr_linenumber" name="415" href="#415">415</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testIgnoreEmptyLines() <strong class="jxr_keyword">throws</strong> IOException {
+<a class="jxr_linenumber" name="416" href="#416">416</a>         <strong class="jxr_keyword">final</strong> String code = <span class="jxr_string">"\nfoo,baar\n\r\n,\n\n,world\r\n\n"</span>;
+<a class="jxr_linenumber" name="417" href="#417">417</a>         <em class="jxr_comment">//String code = "world\r\n\n";</em>
+<a class="jxr_linenumber" name="418" href="#418">418</a>         <em class="jxr_comment">//String code = "foo;baar\r\n\r\nhello;\r\n\r\nworld;\r\n";</em>
+<a class="jxr_linenumber" name="419" href="#419">419</a>         <strong class="jxr_keyword">final</strong> CSVParser parser = <strong class="jxr_keyword">new</strong> CSVParser(<strong class="jxr_keyword">new</strong> StringReader(code));
+<a class="jxr_linenumber" name="420" href="#420">420</a>         <strong class="jxr_keyword">final</strong> List&lt;CSVRecord&gt; records = parser.getRecords();
+<a class="jxr_linenumber" name="421" href="#421">421</a>         assertEquals(3, records.size());
+<a class="jxr_linenumber" name="422" href="#422">422</a>     }
+<a class="jxr_linenumber" name="423" href="#423">423</a> 
+<a class="jxr_linenumber" name="424" href="#424">424</a>     @Test
+<a class="jxr_linenumber" name="425" href="#425">425</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testForEach() <strong class="jxr_keyword">throws</strong> Exception {
+<a class="jxr_linenumber" name="426" href="#426">426</a>         <strong class="jxr_keyword">final</strong> List&lt;CSVRecord&gt; records = <strong class="jxr_keyword">new</strong> ArrayList&lt;CSVRecord&gt;();
+<a class="jxr_linenumber" name="427" href="#427">427</a> 
+<a class="jxr_linenumber" name="428" href="#428">428</a>         <strong class="jxr_keyword">final</strong> Reader in = <strong class="jxr_keyword">new</strong> StringReader(<span class="jxr_string">"a,b,c\n1,2,3\nx,y,z"</span>);
+<a class="jxr_linenumber" name="429" href="#429">429</a> 
+<a class="jxr_linenumber" name="430" href="#430">430</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">final</strong> CSVRecord record : CSVFormat.DEFAULT.parse(in)) {
+<a class="jxr_linenumber" name="431" href="#431">431</a>             records.add(record);
+<a class="jxr_linenumber" name="432" href="#432">432</a>         }
+<a class="jxr_linenumber" name="433" href="#433">433</a> 
+<a class="jxr_linenumber" name="434" href="#434">434</a>         assertEquals(3, records.size());
+<a class="jxr_linenumber" name="435" href="#435">435</a>         assertArrayEquals(<strong class="jxr_keyword">new</strong> String[]{<span class="jxr_string">"a"</span>, <span class="jxr_string">"b"</span>, <span class="jxr_string">"c"</span>}, records.get(0).values());
+<a class="jxr_linenumber" name="436" href="#436">436</a>         assertArrayEquals(<strong class="jxr_keyword">new</strong> String[]{<span class="jxr_string">"1"</span>, <span class="jxr_string">"2"</span>, <span class="jxr_string">"3"</span>}, records.get(1).values());
+<a class="jxr_linenumber" name="437" href="#437">437</a>         assertArrayEquals(<strong class="jxr_keyword">new</strong> String[]{<span class="jxr_string">"x"</span>, <span class="jxr_string">"y"</span>, <span class="jxr_string">"z"</span>}, records.get(2).values());
+<a class="jxr_linenumber" name="438" href="#438">438</a>     }
+<a class="jxr_linenumber" name="439" href="#439">439</a> 
+<a class="jxr_linenumber" name="440" href="#440">440</a>     @Test
+<a class="jxr_linenumber" name="441" href="#441">441</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testRoundtrip() <strong class="jxr_keyword">throws</strong> Exception {
+<a class="jxr_linenumber" name="442" href="#442">442</a>         <strong class="jxr_keyword">final</strong> StringWriter out = <strong class="jxr_keyword">new</strong> StringWriter();
+<a class="jxr_linenumber" name="443" href="#443">443</a>         <strong class="jxr_keyword">final</strong> CSVPrinter printer = <strong class="jxr_keyword">new</strong> CSVPrinter(out, CSVFormat.DEFAULT);
+<a class="jxr_linenumber" name="444" href="#444">444</a>         <strong class="jxr_keyword">final</strong> String input = <span class="jxr_string">"a,b,c\r\n1,2,3\r\nx,y,z\r\n"</span>;
+<a class="jxr_linenumber" name="445" href="#445">445</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">final</strong> CSVRecord record : CSVFormat.DEFAULT.parse(<strong class="jxr_keyword">new</strong> StringReader(input))) {
+<a class="jxr_linenumber" name="446" href="#446">446</a>             printer.printRecord(record);
+<a class="jxr_linenumber" name="447" href="#447">447</a>         }
+<a class="jxr_linenumber" name="448" href="#448">448</a>         assertEquals(input, out.toString());
+<a class="jxr_linenumber" name="449" href="#449">449</a>         printer.close();
 <a class="jxr_linenumber" name="450" href="#450">450</a>     }
 <a class="jxr_linenumber" name="451" href="#451">451</a> 
 <a class="jxr_linenumber" name="452" href="#452">452</a>     @Test
@@ -491,7 +491,7 @@
 <a class="jxr_linenumber" name="481" href="#481">481</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testHeader() <strong class="jxr_keyword">throws</strong> Exception {
 <a class="jxr_linenumber" name="482" href="#482">482</a>         <strong class="jxr_keyword">final</strong> Reader in = <strong class="jxr_keyword">new</strong> StringReader(<span class="jxr_string">"a,b,c\n1,2,3\nx,y,z"</span>);
 <a class="jxr_linenumber" name="483" href="#483">483</a> 
-<a class="jxr_linenumber" name="484" href="#484">484</a>         <strong class="jxr_keyword">final</strong> Iterator&lt;CSVRecord&gt; records = CSVFormat.newBuilder().withHeader().build().parse(in).iterator();
+<a class="jxr_linenumber" name="484" href="#484">484</a>         <strong class="jxr_keyword">final</strong> Iterator&lt;CSVRecord&gt; records = CSVFormat.newBuilder().withHeader().parse(in).iterator();
 <a class="jxr_linenumber" name="485" href="#485">485</a> 
 <a class="jxr_linenumber" name="486" href="#486">486</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; 2; i++) {
 <a class="jxr_linenumber" name="487" href="#487">487</a>             assertTrue(records.hasNext());
@@ -508,7 +508,7 @@
 <a class="jxr_linenumber" name="498" href="#498">498</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testHeaderComment() <strong class="jxr_keyword">throws</strong> Exception {
 <a class="jxr_linenumber" name="499" href="#499">499</a>         <strong class="jxr_keyword">final</strong> Reader in = <strong class="jxr_keyword">new</strong> StringReader(<span class="jxr_string">"# comment\na,b,c\n1,2,3\nx,y,z"</span>);
 <a class="jxr_linenumber" name="500" href="#500">500</a> 
-<a class="jxr_linenumber" name="501" href="#501">501</a>         <strong class="jxr_keyword">final</strong> Iterator&lt;CSVRecord&gt; records = CSVFormat.newBuilder().withCommentStart('#').withHeader().build().parse(in).iterator();
+<a class="jxr_linenumber" name="501" href="#501">501</a>         <strong class="jxr_keyword">final</strong> Iterator&lt;CSVRecord&gt; records = CSVFormat.newBuilder().withCommentStart('#').withHeader().parse(in).iterator();
 <a class="jxr_linenumber" name="502" href="#502">502</a> 
 <a class="jxr_linenumber" name="503" href="#503">503</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; 2; i++) {
 <a class="jxr_linenumber" name="504" href="#504">504</a>             assertTrue(records.hasNext());
@@ -525,7 +525,7 @@
 <a class="jxr_linenumber" name="515" href="#515">515</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testProvidedHeader() <strong class="jxr_keyword">throws</strong> Exception {
 <a class="jxr_linenumber" name="516" href="#516">516</a>         <strong class="jxr_keyword">final</strong> Reader in = <strong class="jxr_keyword">new</strong> StringReader(<span class="jxr_string">"a,b,c\n1,2,3\nx,y,z"</span>);
 <a class="jxr_linenumber" name="517" href="#517">517</a> 
-<a class="jxr_linenumber" name="518" href="#518">518</a>         <strong class="jxr_keyword">final</strong> Iterator&lt;CSVRecord&gt; records = CSVFormat.newBuilder().withHeader(<span class="jxr_string">"A"</span>, <span class="jxr_string">"B"</span>, <span class="jxr_string">"C"</span>).build().parse(in).iterator();
+<a class="jxr_linenumber" name="518" href="#518">518</a>         <strong class="jxr_keyword">final</strong> Iterator&lt;CSVRecord&gt; records = CSVFormat.newBuilder().withHeader(<span class="jxr_string">"A"</span>, <span class="jxr_string">"B"</span>, <span class="jxr_string">"C"</span>).parse(in).iterator();
 <a class="jxr_linenumber" name="519" href="#519">519</a> 
 <a class="jxr_linenumber" name="520" href="#520">520</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; 3; i++) {
 <a class="jxr_linenumber" name="521" href="#521">521</a>             assertTrue(records.hasNext());
@@ -546,7 +546,7 @@
 <a class="jxr_linenumber" name="536" href="#536">536</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testMappedButNotSetAsOutlook2007ContactExport() <strong class="jxr_keyword">throws</strong> Exception {
 <a class="jxr_linenumber" name="537" href="#537">537</a>         <strong class="jxr_keyword">final</strong> Reader in = <strong class="jxr_keyword">new</strong> StringReader(<span class="jxr_string">"a,b,c\n1,2\nx,y,z"</span>);
 <a class="jxr_linenumber" name="538" href="#538">538</a> 
-<a class="jxr_linenumber" name="539" href="#539">539</a>         <strong class="jxr_keyword">final</strong> Iterator&lt;CSVRecord&gt; records = CSVFormat.newBuilder().withHeader(<span class="jxr_string">"A"</span>, <span class="jxr_string">"B"</span>, <span class="jxr_string">"C"</span>).build().parse(in).iterator();
+<a class="jxr_linenumber" name="539" href="#539">539</a>         <strong class="jxr_keyword">final</strong> Iterator&lt;CSVRecord&gt; records = CSVFormat.newBuilder().withHeader(<span class="jxr_string">"A"</span>, <span class="jxr_string">"B"</span>, <span class="jxr_string">"C"</span>).parse(in).iterator();
 <a class="jxr_linenumber" name="540" href="#540">540</a> 
 <a class="jxr_linenumber" name="541" href="#541">541</a>         <em class="jxr_comment">// header record</em>
 <a class="jxr_linenumber" name="542" href="#542">542</a>         assertTrue(records.hasNext());
@@ -571,7 +571,7 @@
 <a class="jxr_linenumber" name="561" href="#561">561</a>         assertFalse(record.isSet(<span class="jxr_string">"C"</span>));
 <a class="jxr_linenumber" name="562" href="#562">562</a>         assertEquals(<span class="jxr_string">"1"</span>, record.get(<span class="jxr_string">"A"</span>));
 <a class="jxr_linenumber" name="563" href="#563">563</a>         assertEquals(<span class="jxr_string">"2"</span>, record.get(<span class="jxr_string">"B"</span>));
-<a class="jxr_linenumber" name="564" href="#564">564</a>         
+<a class="jxr_linenumber" name="564" href="#564">564</a> 
 <a class="jxr_linenumber" name="565" href="#565">565</a>         <em class="jxr_comment">// 2nd record</em>
 <a class="jxr_linenumber" name="566" href="#566">566</a>         record = records.next();
 <a class="jxr_linenumber" name="567" href="#567">567</a>         assertTrue(record.isMapped(<span class="jxr_string">"A"</span>));
@@ -583,119 +583,120 @@
 <a class="jxr_linenumber" name="573" href="#573">573</a>         assertEquals(<span class="jxr_string">"x"</span>, record.get(<span class="jxr_string">"A"</span>));
 <a class="jxr_linenumber" name="574" href="#574">574</a>         assertEquals(<span class="jxr_string">"y"</span>, record.get(<span class="jxr_string">"B"</span>));
 <a class="jxr_linenumber" name="575" href="#575">575</a>         assertEquals(<span class="jxr_string">"z"</span>, record.get(<span class="jxr_string">"C"</span>));
-<a class="jxr_linenumber" name="576" href="#576">576</a>         
+<a class="jxr_linenumber" name="576" href="#576">576</a> 
 <a class="jxr_linenumber" name="577" href="#577">577</a>         assertFalse(records.hasNext());
 <a class="jxr_linenumber" name="578" href="#578">578</a>     }
 <a class="jxr_linenumber" name="579" href="#579">579</a> 
-<a class="jxr_linenumber" name="580" href="#580">580</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testGetHeaderMap() <strong class="jxr_keyword">throws</strong> Exception {
-<a class="jxr_linenumber" name="581" href="#581">581</a>         <strong class="jxr_keyword">final</strong> CSVParser parser = <strong class="jxr_keyword">new</strong> CSVParser(<span class="jxr_string">"a,b,c\n1,2,3\nx,y,z"</span>, CSVFormat.newBuilder().withHeader(<span class="jxr_string">"A"</span>, <span class="jxr_string">"B"</span>, <span class="jxr_string">"C"</span>).build());
-<a class="jxr_linenumber" name="582" href="#582">582</a>         <strong class="jxr_keyword">final</strong> Map&lt;String, Integer&gt; headerMap = parser.getHeaderMap();
-<a class="jxr_linenumber" name="583" href="#583">583</a>         <strong class="jxr_keyword">final</strong> Iterator&lt;String&gt; columnNames = headerMap.keySet().iterator();
-<a class="jxr_linenumber" name="584" href="#584">584</a>         <em class="jxr_comment">// Headers are iterated in column order.</em>
-<a class="jxr_linenumber" name="585" href="#585">585</a>         Assert.assertEquals(<span class="jxr_string">"A"</span>, columnNames.next());
-<a class="jxr_linenumber" name="586" href="#586">586</a>         Assert.assertEquals(<span class="jxr_string">"B"</span>, columnNames.next());
-<a class="jxr_linenumber" name="587" href="#587">587</a>         Assert.assertEquals(<span class="jxr_string">"C"</span>, columnNames.next());
-<a class="jxr_linenumber" name="588" href="#588">588</a>         <strong class="jxr_keyword">final</strong> Iterator&lt;CSVRecord&gt; records = parser.iterator();
-<a class="jxr_linenumber" name="589" href="#589">589</a>         
-<a class="jxr_linenumber" name="590" href="#590">590</a>         <em class="jxr_comment">// Parse to make sure getHeaderMap did not have a side-effect.</em>
-<a class="jxr_linenumber" name="591" href="#591">591</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; 3; i++) {
-<a class="jxr_linenumber" name="592" href="#592">592</a>             assertTrue(records.hasNext());
-<a class="jxr_linenumber" name="593" href="#593">593</a>             <strong class="jxr_keyword">final</strong> CSVRecord record = records.next();
-<a class="jxr_linenumber" name="594" href="#594">594</a>             assertEquals(record.get(0), record.get(<span class="jxr_string">"A"</span>));
-<a class="jxr_linenumber" name="595" href="#595">595</a>             assertEquals(record.get(1), record.get(<span class="jxr_string">"B"</span>));
-<a class="jxr_linenumber" name="596" href="#596">596</a>             assertEquals(record.get(2), record.get(<span class="jxr_string">"C"</span>));
-<a class="jxr_linenumber" name="597" href="#597">597</a>         }
-<a class="jxr_linenumber" name="598" href="#598">598</a> 
-<a class="jxr_linenumber" name="599" href="#599">599</a>         assertFalse(records.hasNext());
-<a class="jxr_linenumber" name="600" href="#600">600</a>     }
-<a class="jxr_linenumber" name="601" href="#601">601</a> 
-<a class="jxr_linenumber" name="602" href="#602">602</a>     @Test
-<a class="jxr_linenumber" name="603" href="#603">603</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testGetLineNumberWithLF() <strong class="jxr_keyword">throws</strong> Exception {
-<a class="jxr_linenumber" name="604" href="#604">604</a>         validateLineNumbers(String.valueOf(LF));
-<a class="jxr_linenumber" name="605" href="#605">605</a>     }
-<a class="jxr_linenumber" name="606" href="#606">606</a> 
-<a class="jxr_linenumber" name="607" href="#607">607</a>     @Test
-<a class="jxr_linenumber" name="608" href="#608">608</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testGetLineNumberWithCRLF() <strong class="jxr_keyword">throws</strong> Exception {
-<a class="jxr_linenumber" name="609" href="#609">609</a>         validateLineNumbers(CRLF);
-<a class="jxr_linenumber" name="610" href="#610">610</a>     }
-<a class="jxr_linenumber" name="611" href="#611">611</a> 
-<a class="jxr_linenumber" name="612" href="#612">612</a>     @Test
-<a class="jxr_linenumber" name="613" href="#613">613</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testGetLineNumberWithCR() <strong class="jxr_keyword">throws</strong> Exception {
-<a class="jxr_linenumber" name="614" href="#614">614</a>         validateLineNumbers(String.valueOf(CR));
-<a class="jxr_linenumber" name="615" href="#615">615</a>     }
-<a class="jxr_linenumber" name="616" href="#616">616</a>     
-<a class="jxr_linenumber" name="617" href="#617">617</a>     @Test
-<a class="jxr_linenumber" name="618" href="#618">618</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testGetRecordNumberWithLF() <strong class="jxr_keyword">throws</strong> Exception {
-<a class="jxr_linenumber" name="619" href="#619">619</a>         validateRecordNumbers(String.valueOf(LF));
-<a class="jxr_linenumber" name="620" href="#620">620</a>     }
-<a class="jxr_linenumber" name="621" href="#621">621</a> 
-<a class="jxr_linenumber" name="622" href="#622">622</a>     @Test
-<a class="jxr_linenumber" name="623" href="#623">623</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testGetRecordWithMultiiLineValues() <strong class="jxr_keyword">throws</strong> Exception {
-<a class="jxr_linenumber" name="624" href="#624">624</a>         <strong class="jxr_keyword">final</strong> CSVParser parser = <strong class="jxr_keyword">new</strong> CSVParser(<span class="jxr_string">"\&quot;a\r\n1\&quot;,\&quot;a\r\n2\&quot;"</span> + CRLF + <span class="jxr_string">"\&quot;b\r\n1\&quot;,\&quot;b\r\n2\&quot;"</span> + CRLF + <span class="jxr_string">"\&quot;c\r\n1\&quot;,\&quot;c\r\n2\&quot;"</span>,
-<a class="jxr_linenumber" name="625" href="#625">625</a>                 CSVFormat.newBuilder().withRecordSeparator(CRLF).build());
-<a class="jxr_linenumber" name="626" href="#626">626</a>         CSVRecord record;
-<a class="jxr_linenumber" name="627" href="#627">627</a>         assertEquals(0, parser.getRecordNumber());
-<a class="jxr_linenumber" name="628" href="#628">628</a>         assertEquals(0, parser.getLineNumber());
-<a class="jxr_linenumber" name="629" href="#629">629</a>         assertNotNull(record = parser.nextRecord());
-<a class="jxr_linenumber" name="630" href="#630">630</a>         assertEquals(3, parser.getLineNumber());
-<a class="jxr_linenumber" name="631" href="#631">631</a>         assertEquals(1, record.getRecordNumber());
-<a class="jxr_linenumber" name="632" href="#632">632</a>         assertEquals(1, parser.getRecordNumber());
-<a class="jxr_linenumber" name="633" href="#633">633</a>         assertNotNull(record = parser.nextRecord());
-<a class="jxr_linenumber" name="634" href="#634">634</a>         assertEquals(6, parser.getLineNumber());
-<a class="jxr_linenumber" name="635" href="#635">635</a>         assertEquals(2, record.getRecordNumber());
-<a class="jxr_linenumber" name="636" href="#636">636</a>         assertEquals(2, parser.getRecordNumber());
-<a class="jxr_linenumber" name="637" href="#637">637</a>         assertNotNull(record = parser.nextRecord());
-<a class="jxr_linenumber" name="638" href="#638">638</a>         assertEquals(8, parser.getLineNumber());
-<a class="jxr_linenumber" name="639" href="#639">639</a>         assertEquals(3, record.getRecordNumber());
-<a class="jxr_linenumber" name="640" href="#640">640</a>         assertEquals(3, parser.getRecordNumber());
-<a class="jxr_linenumber" name="641" href="#641">641</a>         assertNull(record = parser.nextRecord());
-<a class="jxr_linenumber" name="642" href="#642">642</a>         assertEquals(8, parser.getLineNumber());
-<a class="jxr_linenumber" name="643" href="#643">643</a>         assertEquals(3, parser.getRecordNumber());
-<a class="jxr_linenumber" name="644" href="#644">644</a>     }
-<a class="jxr_linenumber" name="645" href="#645">645</a> 
-<a class="jxr_linenumber" name="646" href="#646">646</a>     @Test
-<a class="jxr_linenumber" name="647" href="#647">647</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testGetRecordNumberWithCRLF() <strong class="jxr_keyword">throws</strong> Exception {
-<a class="jxr_linenumber" name="648" href="#648">648</a>         validateRecordNumbers(CRLF);
-<a class="jxr_linenumber" name="649" href="#649">649</a>     }
-<a class="jxr_linenumber" name="650" href="#650">650</a> 
-<a class="jxr_linenumber" name="651" href="#651">651</a>     @Test
-<a class="jxr_linenumber" name="652" href="#652">652</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testGetRecordNumberWithCR() <strong class="jxr_keyword">throws</strong> Exception {
-<a class="jxr_linenumber" name="653" href="#653">653</a>         validateRecordNumbers(String.valueOf(CR));
-<a class="jxr_linenumber" name="654" href="#654">654</a>     }
-<a class="jxr_linenumber" name="655" href="#655">655</a> 
-<a class="jxr_linenumber" name="656" href="#656">656</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">void</strong> validateRecordNumbers(<strong class="jxr_keyword">final</strong> String lineSeparator) <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="657" href="#657">657</a>         <strong class="jxr_keyword">final</strong> CSVParser parser = <strong class="jxr_keyword">new</strong> CSVParser(<span class="jxr_string">"a"</span> + lineSeparator + <span class="jxr_string">"b"</span> + lineSeparator + <span class="jxr_string">"c"</span>, CSVFormat.newBuilder().withRecordSeparator(lineSeparator).build());
-<a class="jxr_linenumber" name="658" href="#658">658</a>         CSVRecord record;
-<a class="jxr_linenumber" name="659" href="#659">659</a>         assertEquals(0, parser.getRecordNumber());
-<a class="jxr_linenumber" name="660" href="#660">660</a>         assertNotNull(record = parser.nextRecord());
-<a class="jxr_linenumber" name="661" href="#661">661</a>         assertEquals(1, record.getRecordNumber());        
-<a class="jxr_linenumber" name="662" href="#662">662</a>         assertEquals(1, parser.getRecordNumber());
-<a class="jxr_linenumber" name="663" href="#663">663</a>         assertNotNull(record = parser.nextRecord());
-<a class="jxr_linenumber" name="664" href="#664">664</a>         assertEquals(2, record.getRecordNumber());        
-<a class="jxr_linenumber" name="665" href="#665">665</a>         assertEquals(2, parser.getRecordNumber());
-<a class="jxr_linenumber" name="666" href="#666">666</a>         assertNotNull(record = parser.nextRecord());
-<a class="jxr_linenumber" name="667" href="#667">667</a>         assertEquals(3, record.getRecordNumber());        
-<a class="jxr_linenumber" name="668" href="#668">668</a>         assertEquals(3, parser.getRecordNumber());
-<a class="jxr_linenumber" name="669" href="#669">669</a>         assertNull(record = parser.nextRecord());
-<a class="jxr_linenumber" name="670" href="#670">670</a>         assertEquals(3, parser.getRecordNumber());
-<a class="jxr_linenumber" name="671" href="#671">671</a>     }
-<a class="jxr_linenumber" name="672" href="#672">672</a> 
-<a class="jxr_linenumber" name="673" href="#673">673</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">void</strong> validateLineNumbers(<strong class="jxr_keyword">final</strong> String lineSeparator) <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="674" href="#674">674</a>         <strong class="jxr_keyword">final</strong> CSVParser parser = <strong class="jxr_keyword">new</strong> CSVParser(<span class="jxr_string">"a"</span> + lineSeparator + <span class="jxr_string">"b"</span> + lineSeparator + <span class="jxr_string">"c"</span>, CSVFormat.newBuilder().withRecordSeparator(lineSeparator).build());
-<a class="jxr_linenumber" name="675" href="#675">675</a>         assertEquals(0, parser.getLineNumber());
-<a class="jxr_linenumber" name="676" href="#676">676</a>         assertNotNull(parser.nextRecord());
-<a class="jxr_linenumber" name="677" href="#677">677</a>         assertEquals(1, parser.getLineNumber());
-<a class="jxr_linenumber" name="678" href="#678">678</a>         assertNotNull(parser.nextRecord());
-<a class="jxr_linenumber" name="679" href="#679">679</a>         assertEquals(2, parser.getLineNumber());
-<a class="jxr_linenumber" name="680" href="#680">680</a>         assertNotNull(parser.nextRecord());
-<a class="jxr_linenumber" name="681" href="#681">681</a>         <em class="jxr_comment">// Still 2 because the last line is does not have EOL chars</em>
-<a class="jxr_linenumber" name="682" href="#682">682</a>         assertEquals(2, parser.getLineNumber());
-<a class="jxr_linenumber" name="683" href="#683">683</a>         assertNull(parser.nextRecord());
-<a class="jxr_linenumber" name="684" href="#684">684</a>         <em class="jxr_comment">// Still 2 because the last line is does not have EOL chars</em>
-<a class="jxr_linenumber" name="685" href="#685">685</a>         assertEquals(2, parser.getLineNumber());
-<a class="jxr_linenumber" name="686" href="#686">686</a>     }
-<a class="jxr_linenumber" name="687" href="#687">687</a> 
-<a class="jxr_linenumber" name="688" href="#688">688</a> }
+<a class="jxr_linenumber" name="580" href="#580">580</a>     @Test
+<a class="jxr_linenumber" name="581" href="#581">581</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testGetHeaderMap() <strong class="jxr_keyword">throws</strong> Exception {
+<a class="jxr_linenumber" name="582" href="#582">582</a>         <strong class="jxr_keyword">final</strong> CSVParser parser = <strong class="jxr_keyword">new</strong> CSVParser(<span class="jxr_string">"a,b,c\n1,2,3\nx,y,z"</span>, CSVFormat.newBuilder().withHeader(<span class="jxr_string">"A"</span>, <span class="jxr_string">"B"</span>, <span class="jxr_string">"C"</span>).build());
+<a class="jxr_linenumber" name="583" href="#583">583</a>         <strong class="jxr_keyword">final</strong> Map&lt;String, Integer&gt; headerMap = parser.getHeaderMap();
+<a class="jxr_linenumber" name="584" href="#584">584</a>         <strong class="jxr_keyword">final</strong> Iterator&lt;String&gt; columnNames = headerMap.keySet().iterator();
+<a class="jxr_linenumber" name="585" href="#585">585</a>         <em class="jxr_comment">// Headers are iterated in column order.</em>
+<a class="jxr_linenumber" name="586" href="#586">586</a>         Assert.assertEquals(<span class="jxr_string">"A"</span>, columnNames.next());
+<a class="jxr_linenumber" name="587" href="#587">587</a>         Assert.assertEquals(<span class="jxr_string">"B"</span>, columnNames.next());
+<a class="jxr_linenumber" name="588" href="#588">588</a>         Assert.assertEquals(<span class="jxr_string">"C"</span>, columnNames.next());
+<a class="jxr_linenumber" name="589" href="#589">589</a>         <strong class="jxr_keyword">final</strong> Iterator&lt;CSVRecord&gt; records = parser.iterator();
+<a class="jxr_linenumber" name="590" href="#590">590</a> 
+<a class="jxr_linenumber" name="591" href="#591">591</a>         <em class="jxr_comment">// Parse to make sure getHeaderMap did not have a side-effect.</em>
+<a class="jxr_linenumber" name="592" href="#592">592</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; 3; i++) {
+<a class="jxr_linenumber" name="593" href="#593">593</a>             assertTrue(records.hasNext());
+<a class="jxr_linenumber" name="594" href="#594">594</a>             <strong class="jxr_keyword">final</strong> CSVRecord record = records.next();
+<a class="jxr_linenumber" name="595" href="#595">595</a>             assertEquals(record.get(0), record.get(<span class="jxr_string">"A"</span>));
+<a class="jxr_linenumber" name="596" href="#596">596</a>             assertEquals(record.get(1), record.get(<span class="jxr_string">"B"</span>));
+<a class="jxr_linenumber" name="597" href="#597">597</a>             assertEquals(record.get(2), record.get(<span class="jxr_string">"C"</span>));
+<a class="jxr_linenumber" name="598" href="#598">598</a>         }
+<a class="jxr_linenumber" name="599" href="#599">599</a> 
+<a class="jxr_linenumber" name="600" href="#600">600</a>         assertFalse(records.hasNext());
+<a class="jxr_linenumber" name="601" href="#601">601</a>     }
+<a class="jxr_linenumber" name="602" href="#602">602</a> 
+<a class="jxr_linenumber" name="603" href="#603">603</a>     @Test
+<a class="jxr_linenumber" name="604" href="#604">604</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testGetLineNumberWithLF() <strong class="jxr_keyword">throws</strong> Exception {
+<a class="jxr_linenumber" name="605" href="#605">605</a>         validateLineNumbers(String.valueOf(LF));
+<a class="jxr_linenumber" name="606" href="#606">606</a>     }
+<a class="jxr_linenumber" name="607" href="#607">607</a> 
+<a class="jxr_linenumber" name="608" href="#608">608</a>     @Test
+<a class="jxr_linenumber" name="609" href="#609">609</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testGetLineNumberWithCRLF() <strong class="jxr_keyword">throws</strong> Exception {
+<a class="jxr_linenumber" name="610" href="#610">610</a>         validateLineNumbers(CRLF);
+<a class="jxr_linenumber" name="611" href="#611">611</a>     }
+<a class="jxr_linenumber" name="612" href="#612">612</a> 
+<a class="jxr_linenumber" name="613" href="#613">613</a>     @Test
+<a class="jxr_linenumber" name="614" href="#614">614</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testGetLineNumberWithCR() <strong class="jxr_keyword">throws</strong> Exception {
+<a class="jxr_linenumber" name="615" href="#615">615</a>         validateLineNumbers(String.valueOf(CR));
+<a class="jxr_linenumber" name="616" href="#616">616</a>     }
+<a class="jxr_linenumber" name="617" href="#617">617</a> 
+<a class="jxr_linenumber" name="618" href="#618">618</a>     @Test
+<a class="jxr_linenumber" name="619" href="#619">619</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testGetRecordNumberWithLF() <strong class="jxr_keyword">throws</strong> Exception {
+<a class="jxr_linenumber" name="620" href="#620">620</a>         validateRecordNumbers(String.valueOf(LF));
+<a class="jxr_linenumber" name="621" href="#621">621</a>     }
+<a class="jxr_linenumber" name="622" href="#622">622</a> 
+<a class="jxr_linenumber" name="623" href="#623">623</a>     @Test
+<a class="jxr_linenumber" name="624" href="#624">624</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testGetRecordWithMultiiLineValues() <strong class="jxr_keyword">throws</strong> Exception {
+<a class="jxr_linenumber" name="625" href="#625">625</a>         <strong class="jxr_keyword">final</strong> CSVParser parser = <strong class="jxr_keyword">new</strong> CSVParser(<span class="jxr_string">"\&quot;a\r\n1\&quot;,\&quot;a\r\n2\&quot;"</span> + CRLF + <span class="jxr_string">"\&quot;b\r\n1\&quot;,\&quot;b\r\n2\&quot;"</span> + CRLF + <span class="jxr_string">"\&quot;c\r\n1\&quot;,\&quot;c\r\n2\&quot;"</span>,
+<a class="jxr_linenumber" name="626" href="#626">626</a>                 CSVFormat.newBuilder().withRecordSeparator(CRLF).build());
+<a class="jxr_linenumber" name="627" href="#627">627</a>         CSVRecord record;
+<a class="jxr_linenumber" name="628" href="#628">628</a>         assertEquals(0, parser.getRecordNumber());
+<a class="jxr_linenumber" name="629" href="#629">629</a>         assertEquals(0, parser.getLineNumber());
+<a class="jxr_linenumber" name="630" href="#630">630</a>         assertNotNull(record = parser.nextRecord());
+<a class="jxr_linenumber" name="631" href="#631">631</a>         assertEquals(3, parser.getLineNumber());
+<a class="jxr_linenumber" name="632" href="#632">632</a>         assertEquals(1, record.getRecordNumber());
+<a class="jxr_linenumber" name="633" href="#633">633</a>         assertEquals(1, parser.getRecordNumber());
+<a class="jxr_linenumber" name="634" href="#634">634</a>         assertNotNull(record = parser.nextRecord());
+<a class="jxr_linenumber" name="635" href="#635">635</a>         assertEquals(6, parser.getLineNumber());
+<a class="jxr_linenumber" name="636" href="#636">636</a>         assertEquals(2, record.getRecordNumber());
+<a class="jxr_linenumber" name="637" href="#637">637</a>         assertEquals(2, parser.getRecordNumber());
+<a class="jxr_linenumber" name="638" href="#638">638</a>         assertNotNull(record = parser.nextRecord());
+<a class="jxr_linenumber" name="639" href="#639">639</a>         assertEquals(8, parser.getLineNumber());
+<a class="jxr_linenumber" name="640" href="#640">640</a>         assertEquals(3, record.getRecordNumber());
+<a class="jxr_linenumber" name="641" href="#641">641</a>         assertEquals(3, parser.getRecordNumber());
+<a class="jxr_linenumber" name="642" href="#642">642</a>         assertNull(record = parser.nextRecord());
+<a class="jxr_linenumber" name="643" href="#643">643</a>         assertEquals(8, parser.getLineNumber());
+<a class="jxr_linenumber" name="644" href="#644">644</a>         assertEquals(3, parser.getRecordNumber());
+<a class="jxr_linenumber" name="645" href="#645">645</a>     }
+<a class="jxr_linenumber" name="646" href="#646">646</a> 
+<a class="jxr_linenumber" name="647" href="#647">647</a>     @Test
+<a class="jxr_linenumber" name="648" href="#648">648</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testGetRecordNumberWithCRLF() <strong class="jxr_keyword">throws</strong> Exception {
+<a class="jxr_linenumber" name="649" href="#649">649</a>         validateRecordNumbers(CRLF);
+<a class="jxr_linenumber" name="650" href="#650">650</a>     }
+<a class="jxr_linenumber" name="651" href="#651">651</a> 
+<a class="jxr_linenumber" name="652" href="#652">652</a>     @Test
+<a class="jxr_linenumber" name="653" href="#653">653</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testGetRecordNumberWithCR() <strong class="jxr_keyword">throws</strong> Exception {
+<a class="jxr_linenumber" name="654" href="#654">654</a>         validateRecordNumbers(String.valueOf(CR));
+<a class="jxr_linenumber" name="655" href="#655">655</a>     }
+<a class="jxr_linenumber" name="656" href="#656">656</a> 
+<a class="jxr_linenumber" name="657" href="#657">657</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">void</strong> validateRecordNumbers(<strong class="jxr_keyword">final</strong> String lineSeparator) <strong class="jxr_keyword">throws</strong> IOException {
+<a class="jxr_linenumber" name="658" href="#658">658</a>         <strong class="jxr_keyword">final</strong> CSVParser parser = <strong class="jxr_keyword">new</strong> CSVParser(<span class="jxr_string">"a"</span> + lineSeparator + <span class="jxr_string">"b"</span> + lineSeparator + <span class="jxr_string">"c"</span>, CSVFormat.newBuilder().withRecordSeparator(lineSeparator).build());
+<a class="jxr_linenumber" name="659" href="#659">659</a>         CSVRecord record;
+<a class="jxr_linenumber" name="660" href="#660">660</a>         assertEquals(0, parser.getRecordNumber());
+<a class="jxr_linenumber" name="661" href="#661">661</a>         assertNotNull(record = parser.nextRecord());
+<a class="jxr_linenumber" name="662" href="#662">662</a>         assertEquals(1, record.getRecordNumber());
+<a class="jxr_linenumber" name="663" href="#663">663</a>         assertEquals(1, parser.getRecordNumber());
+<a class="jxr_linenumber" name="664" href="#664">664</a>         assertNotNull(record = parser.nextRecord());
+<a class="jxr_linenumber" name="665" href="#665">665</a>         assertEquals(2, record.getRecordNumber());
+<a class="jxr_linenumber" name="666" href="#666">666</a>         assertEquals(2, parser.getRecordNumber());
+<a class="jxr_linenumber" name="667" href="#667">667</a>         assertNotNull(record = parser.nextRecord());
+<a class="jxr_linenumber" name="668" href="#668">668</a>         assertEquals(3, record.getRecordNumber());
+<a class="jxr_linenumber" name="669" href="#669">669</a>         assertEquals(3, parser.getRecordNumber());
+<a class="jxr_linenumber" name="670" href="#670">670</a>         assertNull(record = parser.nextRecord());
+<a class="jxr_linenumber" name="671" href="#671">671</a>         assertEquals(3, parser.getRecordNumber());
+<a class="jxr_linenumber" name="672" href="#672">672</a>     }
+<a class="jxr_linenumber" name="673" href="#673">673</a> 
+<a class="jxr_linenumber" name="674" href="#674">674</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">void</strong> validateLineNumbers(<strong class="jxr_keyword">final</strong> String lineSeparator) <strong class="jxr_keyword">throws</strong> IOException {
+<a class="jxr_linenumber" name="675" href="#675">675</a>         <strong class="jxr_keyword">final</strong> CSVParser parser = <strong class="jxr_keyword">new</strong> CSVParser(<span class="jxr_string">"a"</span> + lineSeparator + <span class="jxr_string">"b"</span> + lineSeparator + <span class="jxr_string">"c"</span>, CSVFormat.newBuilder().withRecordSeparator(lineSeparator).build());
+<a class="jxr_linenumber" name="676" href="#676">676</a>         assertEquals(0, parser.getLineNumber());
+<a class="jxr_linenumber" name="677" href="#677">677</a>         assertNotNull(parser.nextRecord());
+<a class="jxr_linenumber" name="678" href="#678">678</a>         assertEquals(1, parser.getLineNumber());
+<a class="jxr_linenumber" name="679" href="#679">679</a>         assertNotNull(parser.nextRecord());
+<a class="jxr_linenumber" name="680" href="#680">680</a>         assertEquals(2, parser.getLineNumber());
+<a class="jxr_linenumber" name="681" href="#681">681</a>         assertNotNull(parser.nextRecord());
+<a class="jxr_linenumber" name="682" href="#682">682</a>         <em class="jxr_comment">// Still 2 because the last line is does not have EOL chars</em>
+<a class="jxr_linenumber" name="683" href="#683">683</a>         assertEquals(2, parser.getLineNumber());
+<a class="jxr_linenumber" name="684" href="#684">684</a>         assertNull(parser.nextRecord());
+<a class="jxr_linenumber" name="685" href="#685">685</a>         <em class="jxr_comment">// Still 2 because the last line is does not have EOL chars</em>
+<a class="jxr_linenumber" name="686" href="#686">686</a>         assertEquals(2, parser.getLineNumber());
+<a class="jxr_linenumber" name="687" href="#687">687</a>     }
+<a class="jxr_linenumber" name="688" href="#688">688</a> 
+<a class="jxr_linenumber" name="689" href="#689">689</a> }
 </pre>
 <hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
 </html>



Mime
View raw message