commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r856056 [18/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/testapidocs/src-html/org/apache/commons/csv/CSVPrinterTest.html
==============================================================================
--- websites/production/commons/content/proper/commons-csv/testapidocs/src-html/org/apache/commons/csv/CSVPrinterTest.html (original)
+++ websites/production/commons/content/proper/commons-csv/testapidocs/src-html/org/apache/commons/csv/CSVPrinterTest.html Tue Mar 26 22:16:19 2013
@@ -37,7 +37,7 @@
 <FONT color="green">034</FONT>    /**<a name="line.34"></a>
 <FONT color="green">035</FONT>     * <a name="line.35"></a>
 <FONT color="green">036</FONT>     * <a name="line.36"></a>
-<FONT color="green">037</FONT>     * @version $Id: CSVPrinterTest.java 1410084 2012-11-15 22:46:56Z ggregory $<a name="line.37"></a>
+<FONT color="green">037</FONT>     * @version $Id: CSVPrinterTest.java 1461192 2013-03-26 15:50:18Z ggregory $<a name="line.37"></a>
 <FONT color="green">038</FONT>     */<a name="line.38"></a>
 <FONT color="green">039</FONT>    public class CSVPrinterTest {<a name="line.39"></a>
 <FONT color="green">040</FONT>    <a name="line.40"></a>
@@ -76,7 +76,7 @@
 <FONT color="green">073</FONT>    <a name="line.73"></a>
 <FONT color="green">074</FONT>            for (int i = 0; i &lt; nLines; i++) {<a name="line.74"></a>
 <FONT color="green">075</FONT>                // for (int j=0; j&lt;lines[i].length; j++) System.out.println("### VALUE=:" + printable(lines[i][j]));<a name="line.75"></a>
-<FONT color="green">076</FONT>                printer.printRecord(lines[i]);<a name="line.76"></a>
+<FONT color="green">076</FONT>                printer.printRecord((Object[])lines[i]);<a name="line.76"></a>
 <FONT color="green">077</FONT>            }<a name="line.77"></a>
 <FONT color="green">078</FONT>    <a name="line.78"></a>
 <FONT color="green">079</FONT>            printer.flush();<a name="line.79"></a>
@@ -151,182 +151,202 @@
 <FONT color="green">148</FONT>            printer.printComment("This is a comment");<a name="line.148"></a>
 <FONT color="green">149</FONT>    <a name="line.149"></a>
 <FONT color="green">150</FONT>            assertEquals("", sw.toString());<a name="line.150"></a>
-<FONT color="green">151</FONT>        }<a name="line.151"></a>
-<FONT color="green">152</FONT>    <a name="line.152"></a>
-<FONT color="green">153</FONT>        @Test<a name="line.153"></a>
-<FONT color="green">154</FONT>        public void testExcelPrintAllArrayOfArrays() throws IOException {<a name="line.154"></a>
-<FONT color="green">155</FONT>            final StringWriter sw = new StringWriter();<a name="line.155"></a>
-<FONT color="green">156</FONT>            final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.EXCEL);<a name="line.156"></a>
-<FONT color="green">157</FONT>            printer.printRecords(new String[][] { { "r1c1", "r1c2" }, { "r2c1", "r2c2" } });<a name="line.157"></a>
-<FONT color="green">158</FONT>            assertEquals("r1c1,r1c2" + recordSeparator + "r2c1,r2c2" + recordSeparator, sw.toString());<a name="line.158"></a>
-<FONT color="green">159</FONT>        }<a name="line.159"></a>
-<FONT color="green">160</FONT>    <a name="line.160"></a>
-<FONT color="green">161</FONT>        @Test<a name="line.161"></a>
-<FONT color="green">162</FONT>        public void testExcelPrintAllArrayOfLists() throws IOException {<a name="line.162"></a>
-<FONT color="green">163</FONT>            final StringWriter sw = new StringWriter();<a name="line.163"></a>
-<FONT color="green">164</FONT>            final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.EXCEL);<a name="line.164"></a>
-<FONT color="green">165</FONT>            printer.printRecords(new List[] { Arrays.asList(new String[] { "r1c1", "r1c2" }), Arrays.asList(new String[] { "r2c1", "r2c2" }) });<a name="line.165"></a>
-<FONT color="green">166</FONT>            assertEquals("r1c1,r1c2" + recordSeparator + "r2c1,r2c2" + recordSeparator, sw.toString());<a name="line.166"></a>
-<FONT color="green">167</FONT>        }<a name="line.167"></a>
-<FONT color="green">168</FONT>    <a name="line.168"></a>
-<FONT color="green">169</FONT>        @Test<a name="line.169"></a>
-<FONT color="green">170</FONT>        public void testExcelPrintAllIterableOfArrays() throws IOException {<a name="line.170"></a>
-<FONT color="green">171</FONT>            final StringWriter sw = new StringWriter();<a name="line.171"></a>
-<FONT color="green">172</FONT>            final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.EXCEL);<a name="line.172"></a>
-<FONT color="green">173</FONT>            printer.printRecords(Arrays.asList(new String[][] { { "r1c1", "r1c2" }, { "r2c1", "r2c2" } }));<a name="line.173"></a>
-<FONT color="green">174</FONT>            assertEquals("r1c1,r1c2" + recordSeparator + "r2c1,r2c2" + recordSeparator, sw.toString());<a name="line.174"></a>
-<FONT color="green">175</FONT>        }<a name="line.175"></a>
-<FONT color="green">176</FONT>    <a name="line.176"></a>
-<FONT color="green">177</FONT>        @Test<a name="line.177"></a>
-<FONT color="green">178</FONT>        public void testExcelPrintAllIterableOfLists() throws IOException {<a name="line.178"></a>
-<FONT color="green">179</FONT>            final StringWriter sw = new StringWriter();<a name="line.179"></a>
-<FONT color="green">180</FONT>            final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.EXCEL);<a name="line.180"></a>
-<FONT color="green">181</FONT>            printer.printRecords(Arrays.asList(new List[] { Arrays.asList(new String[] { "r1c1", "r1c2" }),<a name="line.181"></a>
-<FONT color="green">182</FONT>                    Arrays.asList(new String[] { "r2c1", "r2c2" }) }));<a name="line.182"></a>
-<FONT color="green">183</FONT>            assertEquals("r1c1,r1c2" + recordSeparator + "r2c1,r2c2" + recordSeparator, sw.toString());<a name="line.183"></a>
-<FONT color="green">184</FONT>        }<a name="line.184"></a>
-<FONT color="green">185</FONT>    <a name="line.185"></a>
-<FONT color="green">186</FONT>        @Test<a name="line.186"></a>
-<FONT color="green">187</FONT>        public void testExcelPrinter1() throws IOException {<a name="line.187"></a>
-<FONT color="green">188</FONT>            final StringWriter sw = new StringWriter();<a name="line.188"></a>
-<FONT color="green">189</FONT>            final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.EXCEL);<a name="line.189"></a>
-<FONT color="green">190</FONT>            printer.printRecord("a", "b");<a name="line.190"></a>
-<FONT color="green">191</FONT>            assertEquals("a,b" + recordSeparator, sw.toString());<a name="line.191"></a>
-<FONT color="green">192</FONT>        }<a name="line.192"></a>
-<FONT color="green">193</FONT>    <a name="line.193"></a>
-<FONT color="green">194</FONT>        @Test<a name="line.194"></a>
-<FONT color="green">195</FONT>        public void testExcelPrinter2() throws IOException {<a name="line.195"></a>
-<FONT color="green">196</FONT>            final StringWriter sw = new StringWriter();<a name="line.196"></a>
-<FONT color="green">197</FONT>            final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.EXCEL);<a name="line.197"></a>
-<FONT color="green">198</FONT>            printer.printRecord("a,b", "b");<a name="line.198"></a>
-<FONT color="green">199</FONT>            assertEquals("\"a,b\",b" + recordSeparator, sw.toString());<a name="line.199"></a>
-<FONT color="green">200</FONT>        }<a name="line.200"></a>
-<FONT color="green">201</FONT>    <a name="line.201"></a>
-<FONT color="green">202</FONT>        @Test<a name="line.202"></a>
-<FONT color="green">203</FONT>        public void testJdbcPrinter() throws IOException, ClassNotFoundException, SQLException {<a name="line.203"></a>
-<FONT color="green">204</FONT>            final StringWriter sw = new StringWriter();<a name="line.204"></a>
-<FONT color="green">205</FONT>            Class.forName("org.h2.Driver");<a name="line.205"></a>
-<FONT color="green">206</FONT>            final Connection connection = DriverManager.getConnection("jdbc:h2:mem:my_test;", "sa", "");<a name="line.206"></a>
-<FONT color="green">207</FONT>            try {<a name="line.207"></a>
-<FONT color="green">208</FONT>                final Statement stmt = connection.createStatement();<a name="line.208"></a>
-<FONT color="green">209</FONT>                stmt.execute("CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255))");<a name="line.209"></a>
-<FONT color="green">210</FONT>                stmt.execute("insert into TEST values(1, 'r1')");<a name="line.210"></a>
-<FONT color="green">211</FONT>                stmt.execute("insert into TEST values(2, 'r2')");<a name="line.211"></a>
-<FONT color="green">212</FONT>                final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);<a name="line.212"></a>
-<FONT color="green">213</FONT>                printer.printRecords(stmt.executeQuery("select ID, NAME from TEST"));<a name="line.213"></a>
-<FONT color="green">214</FONT>                assertEquals("1,r1" + recordSeparator + "2,r2" + recordSeparator, sw.toString());<a name="line.214"></a>
-<FONT color="green">215</FONT>            } finally {<a name="line.215"></a>
-<FONT color="green">216</FONT>                connection.close();<a name="line.216"></a>
-<FONT color="green">217</FONT>            }<a name="line.217"></a>
-<FONT color="green">218</FONT>        }<a name="line.218"></a>
-<FONT color="green">219</FONT>    <a name="line.219"></a>
-<FONT color="green">220</FONT>        @Test<a name="line.220"></a>
-<FONT color="green">221</FONT>        public void testMultiLineComment() throws IOException {<a name="line.221"></a>
-<FONT color="green">222</FONT>            final StringWriter sw = new StringWriter();<a name="line.222"></a>
-<FONT color="green">223</FONT>            final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.newBuilder().withCommentStart('#').build());<a name="line.223"></a>
-<FONT color="green">224</FONT>            printer.printComment("This is a comment\non multiple lines");<a name="line.224"></a>
-<FONT color="green">225</FONT>    <a name="line.225"></a>
-<FONT color="green">226</FONT>            assertEquals("# This is a comment" + recordSeparator + "# on multiple lines" + recordSeparator, sw.toString());<a name="line.226"></a>
-<FONT color="green">227</FONT>        }<a name="line.227"></a>
-<FONT color="green">228</FONT>    <a name="line.228"></a>
-<FONT color="green">229</FONT>        @Test<a name="line.229"></a>
-<FONT color="green">230</FONT>        public void testPrinter1() throws IOException {<a name="line.230"></a>
-<FONT color="green">231</FONT>            final StringWriter sw = new StringWriter();<a name="line.231"></a>
-<FONT color="green">232</FONT>            final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);<a name="line.232"></a>
-<FONT color="green">233</FONT>            printer.printRecord("a", "b");<a name="line.233"></a>
-<FONT color="green">234</FONT>            assertEquals("a,b" + recordSeparator, sw.toString());<a name="line.234"></a>
-<FONT color="green">235</FONT>        }<a name="line.235"></a>
-<FONT color="green">236</FONT>    <a name="line.236"></a>
-<FONT color="green">237</FONT>        @Test<a name="line.237"></a>
-<FONT color="green">238</FONT>        public void testPrinter2() throws IOException {<a name="line.238"></a>
-<FONT color="green">239</FONT>            final StringWriter sw = new StringWriter();<a name="line.239"></a>
-<FONT color="green">240</FONT>            final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);<a name="line.240"></a>
-<FONT color="green">241</FONT>            printer.printRecord("a,b", "b");<a name="line.241"></a>
-<FONT color="green">242</FONT>            assertEquals("\"a,b\",b" + recordSeparator, sw.toString());<a name="line.242"></a>
-<FONT color="green">243</FONT>        }<a name="line.243"></a>
-<FONT color="green">244</FONT>    <a name="line.244"></a>
-<FONT color="green">245</FONT>        @Test<a name="line.245"></a>
-<FONT color="green">246</FONT>        public void testPrinter3() throws IOException {<a name="line.246"></a>
-<FONT color="green">247</FONT>            final StringWriter sw = new StringWriter();<a name="line.247"></a>
-<FONT color="green">248</FONT>            final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);<a name="line.248"></a>
-<FONT color="green">249</FONT>            printer.printRecord("a, b", "b ");<a name="line.249"></a>
-<FONT color="green">250</FONT>            assertEquals("\"a, b\",\"b \"" + recordSeparator, sw.toString());<a name="line.250"></a>
-<FONT color="green">251</FONT>        }<a name="line.251"></a>
-<FONT color="green">252</FONT>    <a name="line.252"></a>
-<FONT color="green">253</FONT>        @Test<a name="line.253"></a>
-<FONT color="green">254</FONT>        public void testPrinter4() throws IOException {<a name="line.254"></a>
-<FONT color="green">255</FONT>            final StringWriter sw = new StringWriter();<a name="line.255"></a>
-<FONT color="green">256</FONT>            final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);<a name="line.256"></a>
-<FONT color="green">257</FONT>            printer.printRecord("a", "b\"c");<a name="line.257"></a>
-<FONT color="green">258</FONT>            assertEquals("a,\"b\"\"c\"" + recordSeparator, sw.toString());<a name="line.258"></a>
-<FONT color="green">259</FONT>        }<a name="line.259"></a>
-<FONT color="green">260</FONT>    <a name="line.260"></a>
-<FONT color="green">261</FONT>        @Test<a name="line.261"></a>
-<FONT color="green">262</FONT>        public void testPrinter5() throws IOException {<a name="line.262"></a>
-<FONT color="green">263</FONT>            final StringWriter sw = new StringWriter();<a name="line.263"></a>
-<FONT color="green">264</FONT>            final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);<a name="line.264"></a>
-<FONT color="green">265</FONT>            printer.printRecord("a", "b\nc");<a name="line.265"></a>
-<FONT color="green">266</FONT>            assertEquals("a,\"b\nc\"" + recordSeparator, sw.toString());<a name="line.266"></a>
-<FONT color="green">267</FONT>        }<a name="line.267"></a>
-<FONT color="green">268</FONT>    <a name="line.268"></a>
-<FONT color="green">269</FONT>        @Test<a name="line.269"></a>
-<FONT color="green">270</FONT>        public void testPrinter6() throws IOException {<a name="line.270"></a>
-<FONT color="green">271</FONT>            final StringWriter sw = new StringWriter();<a name="line.271"></a>
-<FONT color="green">272</FONT>            final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);<a name="line.272"></a>
-<FONT color="green">273</FONT>            printer.printRecord("a", "b\r\nc");<a name="line.273"></a>
-<FONT color="green">274</FONT>            assertEquals("a,\"b\r\nc\"" + recordSeparator, sw.toString());<a name="line.274"></a>
-<FONT color="green">275</FONT>        }<a name="line.275"></a>
-<FONT color="green">276</FONT>    <a name="line.276"></a>
-<FONT color="green">277</FONT>        @Test<a name="line.277"></a>
-<FONT color="green">278</FONT>        public void testPrinter7() throws IOException {<a name="line.278"></a>
-<FONT color="green">279</FONT>            final StringWriter sw = new StringWriter();<a name="line.279"></a>
-<FONT color="green">280</FONT>            final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);<a name="line.280"></a>
-<FONT color="green">281</FONT>            printer.printRecord("a", "b\\c");<a name="line.281"></a>
-<FONT color="green">282</FONT>            assertEquals("a,b\\c" + recordSeparator, sw.toString());<a name="line.282"></a>
-<FONT color="green">283</FONT>        }<a name="line.283"></a>
-<FONT color="green">284</FONT>    <a name="line.284"></a>
-<FONT color="green">285</FONT>        @Test<a name="line.285"></a>
-<FONT color="green">286</FONT>        public void testPrintNullValues() throws IOException {<a name="line.286"></a>
-<FONT color="green">287</FONT>            final StringWriter sw = new StringWriter();<a name="line.287"></a>
-<FONT color="green">288</FONT>            final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);<a name="line.288"></a>
-<FONT color="green">289</FONT>            printer.printRecord("a", null, "b");<a name="line.289"></a>
-<FONT color="green">290</FONT>            assertEquals("a,,b" + recordSeparator, sw.toString());<a name="line.290"></a>
-<FONT color="green">291</FONT>        }<a name="line.291"></a>
-<FONT color="green">292</FONT>    <a name="line.292"></a>
-<FONT color="green">293</FONT>        @Test<a name="line.293"></a>
-<FONT color="green">294</FONT>        public void testQuoteAll() throws IOException {<a name="line.294"></a>
-<FONT color="green">295</FONT>            final StringWriter sw = new StringWriter();<a name="line.295"></a>
-<FONT color="green">296</FONT>            final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.newBuilder().withQuotePolicy(Quote.ALL).build());<a name="line.296"></a>
-<FONT color="green">297</FONT>            printer.printRecord("a", "b\nc", "d");<a name="line.297"></a>
-<FONT color="green">298</FONT>            assertEquals("\"a\",\"b\nc\",\"d\"" + recordSeparator, sw.toString());<a name="line.298"></a>
+<FONT color="green">151</FONT>            printer.close();<a name="line.151"></a>
+<FONT color="green">152</FONT>        }<a name="line.152"></a>
+<FONT color="green">153</FONT>    <a name="line.153"></a>
+<FONT color="green">154</FONT>        @Test<a name="line.154"></a>
+<FONT color="green">155</FONT>        public void testExcelPrintAllArrayOfArrays() throws IOException {<a name="line.155"></a>
+<FONT color="green">156</FONT>            final StringWriter sw = new StringWriter();<a name="line.156"></a>
+<FONT color="green">157</FONT>            final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.EXCEL);<a name="line.157"></a>
+<FONT color="green">158</FONT>            printer.printRecords(new String[][] { { "r1c1", "r1c2" }, { "r2c1", "r2c2" } });<a name="line.158"></a>
+<FONT color="green">159</FONT>            assertEquals("r1c1,r1c2" + recordSeparator + "r2c1,r2c2" + recordSeparator, sw.toString());<a name="line.159"></a>
+<FONT color="green">160</FONT>            printer.close();<a name="line.160"></a>
+<FONT color="green">161</FONT>        }<a name="line.161"></a>
+<FONT color="green">162</FONT>    <a name="line.162"></a>
+<FONT color="green">163</FONT>        @Test<a name="line.163"></a>
+<FONT color="green">164</FONT>        public void testExcelPrintAllArrayOfLists() throws IOException {<a name="line.164"></a>
+<FONT color="green">165</FONT>            final StringWriter sw = new StringWriter();<a name="line.165"></a>
+<FONT color="green">166</FONT>            final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.EXCEL);<a name="line.166"></a>
+<FONT color="green">167</FONT>            printer.printRecords(new List[] { Arrays.asList(new String[] { "r1c1", "r1c2" }), Arrays.asList(new String[] { "r2c1", "r2c2" }) });<a name="line.167"></a>
+<FONT color="green">168</FONT>            assertEquals("r1c1,r1c2" + recordSeparator + "r2c1,r2c2" + recordSeparator, sw.toString());<a name="line.168"></a>
+<FONT color="green">169</FONT>            printer.close();<a name="line.169"></a>
+<FONT color="green">170</FONT>        }<a name="line.170"></a>
+<FONT color="green">171</FONT>    <a name="line.171"></a>
+<FONT color="green">172</FONT>        @Test<a name="line.172"></a>
+<FONT color="green">173</FONT>        public void testExcelPrintAllIterableOfArrays() throws IOException {<a name="line.173"></a>
+<FONT color="green">174</FONT>            final StringWriter sw = new StringWriter();<a name="line.174"></a>
+<FONT color="green">175</FONT>            final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.EXCEL);<a name="line.175"></a>
+<FONT color="green">176</FONT>            printer.printRecords(Arrays.asList(new String[][] { { "r1c1", "r1c2" }, { "r2c1", "r2c2" } }));<a name="line.176"></a>
+<FONT color="green">177</FONT>            assertEquals("r1c1,r1c2" + recordSeparator + "r2c1,r2c2" + recordSeparator, sw.toString());<a name="line.177"></a>
+<FONT color="green">178</FONT>            printer.close();<a name="line.178"></a>
+<FONT color="green">179</FONT>        }<a name="line.179"></a>
+<FONT color="green">180</FONT>    <a name="line.180"></a>
+<FONT color="green">181</FONT>        @Test<a name="line.181"></a>
+<FONT color="green">182</FONT>        public void testExcelPrintAllIterableOfLists() throws IOException {<a name="line.182"></a>
+<FONT color="green">183</FONT>            final StringWriter sw = new StringWriter();<a name="line.183"></a>
+<FONT color="green">184</FONT>            final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.EXCEL);<a name="line.184"></a>
+<FONT color="green">185</FONT>            printer.printRecords(Arrays.asList(new List[] { Arrays.asList(new String[] { "r1c1", "r1c2" }),<a name="line.185"></a>
+<FONT color="green">186</FONT>                    Arrays.asList(new String[] { "r2c1", "r2c2" }) }));<a name="line.186"></a>
+<FONT color="green">187</FONT>            assertEquals("r1c1,r1c2" + recordSeparator + "r2c1,r2c2" + recordSeparator, sw.toString());<a name="line.187"></a>
+<FONT color="green">188</FONT>            printer.close();<a name="line.188"></a>
+<FONT color="green">189</FONT>        }<a name="line.189"></a>
+<FONT color="green">190</FONT>    <a name="line.190"></a>
+<FONT color="green">191</FONT>        @Test<a name="line.191"></a>
+<FONT color="green">192</FONT>        public void testExcelPrinter1() throws IOException {<a name="line.192"></a>
+<FONT color="green">193</FONT>            final StringWriter sw = new StringWriter();<a name="line.193"></a>
+<FONT color="green">194</FONT>            final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.EXCEL);<a name="line.194"></a>
+<FONT color="green">195</FONT>            printer.printRecord("a", "b");<a name="line.195"></a>
+<FONT color="green">196</FONT>            assertEquals("a,b" + recordSeparator, sw.toString());<a name="line.196"></a>
+<FONT color="green">197</FONT>            printer.close();<a name="line.197"></a>
+<FONT color="green">198</FONT>        }<a name="line.198"></a>
+<FONT color="green">199</FONT>    <a name="line.199"></a>
+<FONT color="green">200</FONT>        @Test<a name="line.200"></a>
+<FONT color="green">201</FONT>        public void testExcelPrinter2() throws IOException {<a name="line.201"></a>
+<FONT color="green">202</FONT>            final StringWriter sw = new StringWriter();<a name="line.202"></a>
+<FONT color="green">203</FONT>            final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.EXCEL);<a name="line.203"></a>
+<FONT color="green">204</FONT>            printer.printRecord("a,b", "b");<a name="line.204"></a>
+<FONT color="green">205</FONT>            assertEquals("\"a,b\",b" + recordSeparator, sw.toString());<a name="line.205"></a>
+<FONT color="green">206</FONT>            printer.close();<a name="line.206"></a>
+<FONT color="green">207</FONT>        }<a name="line.207"></a>
+<FONT color="green">208</FONT>    <a name="line.208"></a>
+<FONT color="green">209</FONT>        @Test<a name="line.209"></a>
+<FONT color="green">210</FONT>        public void testJdbcPrinter() throws IOException, ClassNotFoundException, SQLException {<a name="line.210"></a>
+<FONT color="green">211</FONT>            final StringWriter sw = new StringWriter();<a name="line.211"></a>
+<FONT color="green">212</FONT>            Class.forName("org.h2.Driver");<a name="line.212"></a>
+<FONT color="green">213</FONT>            final Connection connection = DriverManager.getConnection("jdbc:h2:mem:my_test;", "sa", "");<a name="line.213"></a>
+<FONT color="green">214</FONT>            try {<a name="line.214"></a>
+<FONT color="green">215</FONT>                final Statement stmt = connection.createStatement();<a name="line.215"></a>
+<FONT color="green">216</FONT>                stmt.execute("CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255))");<a name="line.216"></a>
+<FONT color="green">217</FONT>                stmt.execute("insert into TEST values(1, 'r1')");<a name="line.217"></a>
+<FONT color="green">218</FONT>                stmt.execute("insert into TEST values(2, 'r2')");<a name="line.218"></a>
+<FONT color="green">219</FONT>                final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);<a name="line.219"></a>
+<FONT color="green">220</FONT>                printer.printRecords(stmt.executeQuery("select ID, NAME from TEST"));<a name="line.220"></a>
+<FONT color="green">221</FONT>                assertEquals("1,r1" + recordSeparator + "2,r2" + recordSeparator, sw.toString());<a name="line.221"></a>
+<FONT color="green">222</FONT>                printer.close();<a name="line.222"></a>
+<FONT color="green">223</FONT>            } finally {<a name="line.223"></a>
+<FONT color="green">224</FONT>                connection.close();<a name="line.224"></a>
+<FONT color="green">225</FONT>            }<a name="line.225"></a>
+<FONT color="green">226</FONT>        }<a name="line.226"></a>
+<FONT color="green">227</FONT>    <a name="line.227"></a>
+<FONT color="green">228</FONT>        @Test<a name="line.228"></a>
+<FONT color="green">229</FONT>        public void testMultiLineComment() throws IOException {<a name="line.229"></a>
+<FONT color="green">230</FONT>            final StringWriter sw = new StringWriter();<a name="line.230"></a>
+<FONT color="green">231</FONT>            final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.newBuilder().withCommentStart('#').build());<a name="line.231"></a>
+<FONT color="green">232</FONT>            printer.printComment("This is a comment\non multiple lines");<a name="line.232"></a>
+<FONT color="green">233</FONT>    <a name="line.233"></a>
+<FONT color="green">234</FONT>            assertEquals("# This is a comment" + recordSeparator + "# on multiple lines" + recordSeparator, sw.toString());<a name="line.234"></a>
+<FONT color="green">235</FONT>            printer.close();<a name="line.235"></a>
+<FONT color="green">236</FONT>        }<a name="line.236"></a>
+<FONT color="green">237</FONT>    <a name="line.237"></a>
+<FONT color="green">238</FONT>        @Test<a name="line.238"></a>
+<FONT color="green">239</FONT>        public void testPrinter1() throws IOException {<a name="line.239"></a>
+<FONT color="green">240</FONT>            final StringWriter sw = new StringWriter();<a name="line.240"></a>
+<FONT color="green">241</FONT>            final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);<a name="line.241"></a>
+<FONT color="green">242</FONT>            printer.printRecord("a", "b");<a name="line.242"></a>
+<FONT color="green">243</FONT>            assertEquals("a,b" + recordSeparator, sw.toString());<a name="line.243"></a>
+<FONT color="green">244</FONT>            printer.close();<a name="line.244"></a>
+<FONT color="green">245</FONT>        }<a name="line.245"></a>
+<FONT color="green">246</FONT>    <a name="line.246"></a>
+<FONT color="green">247</FONT>        @Test<a name="line.247"></a>
+<FONT color="green">248</FONT>        public void testPrinter2() throws IOException {<a name="line.248"></a>
+<FONT color="green">249</FONT>            final StringWriter sw = new StringWriter();<a name="line.249"></a>
+<FONT color="green">250</FONT>            final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);<a name="line.250"></a>
+<FONT color="green">251</FONT>            printer.printRecord("a,b", "b");<a name="line.251"></a>
+<FONT color="green">252</FONT>            assertEquals("\"a,b\",b" + recordSeparator, sw.toString());<a name="line.252"></a>
+<FONT color="green">253</FONT>            printer.close();<a name="line.253"></a>
+<FONT color="green">254</FONT>        }<a name="line.254"></a>
+<FONT color="green">255</FONT>    <a name="line.255"></a>
+<FONT color="green">256</FONT>        @Test<a name="line.256"></a>
+<FONT color="green">257</FONT>        public void testPrinter3() throws IOException {<a name="line.257"></a>
+<FONT color="green">258</FONT>            final StringWriter sw = new StringWriter();<a name="line.258"></a>
+<FONT color="green">259</FONT>            final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);<a name="line.259"></a>
+<FONT color="green">260</FONT>            printer.printRecord("a, b", "b ");<a name="line.260"></a>
+<FONT color="green">261</FONT>            assertEquals("\"a, b\",\"b \"" + recordSeparator, sw.toString());<a name="line.261"></a>
+<FONT color="green">262</FONT>            printer.close();<a name="line.262"></a>
+<FONT color="green">263</FONT>        }<a name="line.263"></a>
+<FONT color="green">264</FONT>    <a name="line.264"></a>
+<FONT color="green">265</FONT>        @Test<a name="line.265"></a>
+<FONT color="green">266</FONT>        public void testPrinter4() throws IOException {<a name="line.266"></a>
+<FONT color="green">267</FONT>            final StringWriter sw = new StringWriter();<a name="line.267"></a>
+<FONT color="green">268</FONT>            final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);<a name="line.268"></a>
+<FONT color="green">269</FONT>            printer.printRecord("a", "b\"c");<a name="line.269"></a>
+<FONT color="green">270</FONT>            assertEquals("a,\"b\"\"c\"" + recordSeparator, sw.toString());<a name="line.270"></a>
+<FONT color="green">271</FONT>            printer.close();<a name="line.271"></a>
+<FONT color="green">272</FONT>        }<a name="line.272"></a>
+<FONT color="green">273</FONT>    <a name="line.273"></a>
+<FONT color="green">274</FONT>        @Test<a name="line.274"></a>
+<FONT color="green">275</FONT>        public void testPrinter5() throws IOException {<a name="line.275"></a>
+<FONT color="green">276</FONT>            final StringWriter sw = new StringWriter();<a name="line.276"></a>
+<FONT color="green">277</FONT>            final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);<a name="line.277"></a>
+<FONT color="green">278</FONT>            printer.printRecord("a", "b\nc");<a name="line.278"></a>
+<FONT color="green">279</FONT>            assertEquals("a,\"b\nc\"" + recordSeparator, sw.toString());<a name="line.279"></a>
+<FONT color="green">280</FONT>            printer.close();<a name="line.280"></a>
+<FONT color="green">281</FONT>        }<a name="line.281"></a>
+<FONT color="green">282</FONT>    <a name="line.282"></a>
+<FONT color="green">283</FONT>        @Test<a name="line.283"></a>
+<FONT color="green">284</FONT>        public void testPrinter6() throws IOException {<a name="line.284"></a>
+<FONT color="green">285</FONT>            final StringWriter sw = new StringWriter();<a name="line.285"></a>
+<FONT color="green">286</FONT>            final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);<a name="line.286"></a>
+<FONT color="green">287</FONT>            printer.printRecord("a", "b\r\nc");<a name="line.287"></a>
+<FONT color="green">288</FONT>            assertEquals("a,\"b\r\nc\"" + recordSeparator, sw.toString());<a name="line.288"></a>
+<FONT color="green">289</FONT>            printer.close();<a name="line.289"></a>
+<FONT color="green">290</FONT>        }<a name="line.290"></a>
+<FONT color="green">291</FONT>    <a name="line.291"></a>
+<FONT color="green">292</FONT>        @Test<a name="line.292"></a>
+<FONT color="green">293</FONT>        public void testPrinter7() throws IOException {<a name="line.293"></a>
+<FONT color="green">294</FONT>            final StringWriter sw = new StringWriter();<a name="line.294"></a>
+<FONT color="green">295</FONT>            final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);<a name="line.295"></a>
+<FONT color="green">296</FONT>            printer.printRecord("a", "b\\c");<a name="line.296"></a>
+<FONT color="green">297</FONT>            assertEquals("a,b\\c" + recordSeparator, sw.toString());<a name="line.297"></a>
+<FONT color="green">298</FONT>            printer.close();<a name="line.298"></a>
 <FONT color="green">299</FONT>        }<a name="line.299"></a>
 <FONT color="green">300</FONT>    <a name="line.300"></a>
 <FONT color="green">301</FONT>        @Test<a name="line.301"></a>
-<FONT color="green">302</FONT>        public void testQuoteNonNumeric() throws IOException {<a name="line.302"></a>
+<FONT color="green">302</FONT>        public void testPrintNullValues() throws IOException {<a name="line.302"></a>
 <FONT color="green">303</FONT>            final StringWriter sw = new StringWriter();<a name="line.303"></a>
-<FONT color="green">304</FONT>            final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.newBuilder().withQuotePolicy(Quote.NON_NUMERIC).build());<a name="line.304"></a>
-<FONT color="green">305</FONT>            printer.printRecord("a", "b\nc", Integer.valueOf(1));<a name="line.305"></a>
-<FONT color="green">306</FONT>            assertEquals("\"a\",\"b\nc\",1" + recordSeparator, sw.toString());<a name="line.306"></a>
-<FONT color="green">307</FONT>        }<a name="line.307"></a>
-<FONT color="green">308</FONT>    <a name="line.308"></a>
-<FONT color="green">309</FONT>        @Test<a name="line.309"></a>
-<FONT color="green">310</FONT>        public void testRandom() throws Exception {<a name="line.310"></a>
-<FONT color="green">311</FONT>            final int iter = 10000;<a name="line.311"></a>
-<FONT color="green">312</FONT>            doRandom(CSVFormat.DEFAULT, iter);<a name="line.312"></a>
-<FONT color="green">313</FONT>            doRandom(CSVFormat.EXCEL, iter);<a name="line.313"></a>
-<FONT color="green">314</FONT>            doRandom(CSVFormat.MYSQL, iter);<a name="line.314"></a>
-<FONT color="green">315</FONT>        }<a name="line.315"></a>
-<FONT color="green">316</FONT>    <a name="line.316"></a>
-<FONT color="green">317</FONT>        @Test<a name="line.317"></a>
-<FONT color="green">318</FONT>        public void testSingleLineComment() throws IOException {<a name="line.318"></a>
-<FONT color="green">319</FONT>            final StringWriter sw = new StringWriter();<a name="line.319"></a>
-<FONT color="green">320</FONT>            final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.newBuilder().withCommentStart('#').build());<a name="line.320"></a>
-<FONT color="green">321</FONT>            printer.printComment("This is a comment");<a name="line.321"></a>
-<FONT color="green">322</FONT>    <a name="line.322"></a>
-<FONT color="green">323</FONT>            assertEquals("# This is a comment" + recordSeparator, sw.toString());<a name="line.323"></a>
-<FONT color="green">324</FONT>        }<a name="line.324"></a>
-<FONT color="green">325</FONT>    <a name="line.325"></a>
-<FONT color="green">326</FONT>    }<a name="line.326"></a>
+<FONT color="green">304</FONT>            final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);<a name="line.304"></a>
+<FONT color="green">305</FONT>            printer.printRecord("a", null, "b");<a name="line.305"></a>
+<FONT color="green">306</FONT>            assertEquals("a,,b" + recordSeparator, sw.toString());<a name="line.306"></a>
+<FONT color="green">307</FONT>            printer.close();<a name="line.307"></a>
+<FONT color="green">308</FONT>        }<a name="line.308"></a>
+<FONT color="green">309</FONT>    <a name="line.309"></a>
+<FONT color="green">310</FONT>        @Test<a name="line.310"></a>
+<FONT color="green">311</FONT>        public void testQuoteAll() throws IOException {<a name="line.311"></a>
+<FONT color="green">312</FONT>            final StringWriter sw = new StringWriter();<a name="line.312"></a>
+<FONT color="green">313</FONT>            final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.newBuilder().withQuotePolicy(Quote.ALL).build());<a name="line.313"></a>
+<FONT color="green">314</FONT>            printer.printRecord("a", "b\nc", "d");<a name="line.314"></a>
+<FONT color="green">315</FONT>            assertEquals("\"a\",\"b\nc\",\"d\"" + recordSeparator, sw.toString());<a name="line.315"></a>
+<FONT color="green">316</FONT>            printer.close();<a name="line.316"></a>
+<FONT color="green">317</FONT>        }<a name="line.317"></a>
+<FONT color="green">318</FONT>    <a name="line.318"></a>
+<FONT color="green">319</FONT>        @Test<a name="line.319"></a>
+<FONT color="green">320</FONT>        public void testQuoteNonNumeric() throws IOException {<a name="line.320"></a>
+<FONT color="green">321</FONT>            final StringWriter sw = new StringWriter();<a name="line.321"></a>
+<FONT color="green">322</FONT>            final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.newBuilder().withQuotePolicy(Quote.NON_NUMERIC).build());<a name="line.322"></a>
+<FONT color="green">323</FONT>            printer.printRecord("a", "b\nc", Integer.valueOf(1));<a name="line.323"></a>
+<FONT color="green">324</FONT>            assertEquals("\"a\",\"b\nc\",1" + recordSeparator, sw.toString());<a name="line.324"></a>
+<FONT color="green">325</FONT>            printer.close();<a name="line.325"></a>
+<FONT color="green">326</FONT>        }<a name="line.326"></a>
+<FONT color="green">327</FONT>    <a name="line.327"></a>
+<FONT color="green">328</FONT>        @Test<a name="line.328"></a>
+<FONT color="green">329</FONT>        public void testRandom() throws Exception {<a name="line.329"></a>
+<FONT color="green">330</FONT>            final int iter = 10000;<a name="line.330"></a>
+<FONT color="green">331</FONT>            doRandom(CSVFormat.DEFAULT, iter);<a name="line.331"></a>
+<FONT color="green">332</FONT>            doRandom(CSVFormat.EXCEL, iter);<a name="line.332"></a>
+<FONT color="green">333</FONT>            doRandom(CSVFormat.MYSQL, iter);<a name="line.333"></a>
+<FONT color="green">334</FONT>        }<a name="line.334"></a>
+<FONT color="green">335</FONT>    <a name="line.335"></a>
+<FONT color="green">336</FONT>        @Test<a name="line.336"></a>
+<FONT color="green">337</FONT>        public void testSingleLineComment() throws IOException {<a name="line.337"></a>
+<FONT color="green">338</FONT>            final StringWriter sw = new StringWriter();<a name="line.338"></a>
+<FONT color="green">339</FONT>            final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.newBuilder().withCommentStart('#').build());<a name="line.339"></a>
+<FONT color="green">340</FONT>            printer.printComment("This is a comment");<a name="line.340"></a>
+<FONT color="green">341</FONT>    <a name="line.341"></a>
+<FONT color="green">342</FONT>            assertEquals("# This is a comment" + recordSeparator, sw.toString());<a name="line.342"></a>
+<FONT color="green">343</FONT>            printer.close();<a name="line.343"></a>
+<FONT color="green">344</FONT>        }<a name="line.344"></a>
+<FONT color="green">345</FONT>    <a name="line.345"></a>
+<FONT color="green">346</FONT>    }<a name="line.346"></a>
 
 
 

Modified: websites/production/commons/content/proper/commons-csv/testapidocs/src-html/org/apache/commons/csv/PerformanceTest.html
==============================================================================
--- websites/production/commons/content/proper/commons-csv/testapidocs/src-html/org/apache/commons/csv/PerformanceTest.html (original)
+++ websites/production/commons/content/proper/commons-csv/testapidocs/src-html/org/apache/commons/csv/PerformanceTest.html Tue Mar 26 22:16:19 2013
@@ -229,68 +229,67 @@
 <FONT color="green">226</FONT>    <a name="line.226"></a>
 <FONT color="green">227</FONT>       private static Constructor&lt;Lexer&gt; getLexerCtor(final String clazz) throws Exception {<a name="line.227"></a>
 <FONT color="green">228</FONT>           @SuppressWarnings("unchecked")<a name="line.228"></a>
-<FONT color="green">229</FONT>           final Class&lt;Lexer&gt; lexer = (Class&lt;Lexer&gt;) Class.forName("org.apache.commons.csv."+clazz);<a name="line.229"></a>
-<FONT color="green">230</FONT>           final Constructor&lt;Lexer&gt; ctor = lexer.getConstructor(new Class&lt;?&gt;[]{CSVFormat.class, ExtendedBufferedReader.class});<a name="line.230"></a>
-<FONT color="green">231</FONT>           return ctor;<a name="line.231"></a>
-<FONT color="green">232</FONT>       }<a name="line.232"></a>
-<FONT color="green">233</FONT>    <a name="line.233"></a>
-<FONT color="green">234</FONT>       private static void testCSVLexer(final boolean newToken, final String test) throws Exception {<a name="line.234"></a>
-<FONT color="green">235</FONT>           Token token = new Token();<a name="line.235"></a>
-<FONT color="green">236</FONT>           String dynamic = "";<a name="line.236"></a>
-<FONT color="green">237</FONT>           for (int i = 0; i &lt; max; i++) {<a name="line.237"></a>
-<FONT color="green">238</FONT>               final ExtendedBufferedReader input = new ExtendedBufferedReader(getReader());<a name="line.238"></a>
-<FONT color="green">239</FONT>               Lexer lexer = null;<a name="line.239"></a>
-<FONT color="green">240</FONT>               if (test.startsWith("CSVLexer")) {<a name="line.240"></a>
-<FONT color="green">241</FONT>                   dynamic="!";<a name="line.241"></a>
-<FONT color="green">242</FONT>                   lexer = getLexerCtor(test).newInstance(new Object[]{format, input});<a name="line.242"></a>
-<FONT color="green">243</FONT>               } else {<a name="line.243"></a>
-<FONT color="green">244</FONT>                   lexer = new CSVLexer(format, input);<a name="line.244"></a>
-<FONT color="green">245</FONT>               }<a name="line.245"></a>
-<FONT color="green">246</FONT>               int count = 0;<a name="line.246"></a>
-<FONT color="green">247</FONT>               int fields = 0;<a name="line.247"></a>
-<FONT color="green">248</FONT>               final long t0 = System.currentTimeMillis();<a name="line.248"></a>
-<FONT color="green">249</FONT>               do {<a name="line.249"></a>
-<FONT color="green">250</FONT>                   if (newToken) {<a name="line.250"></a>
-<FONT color="green">251</FONT>                       token = new Token();<a name="line.251"></a>
-<FONT color="green">252</FONT>                   } else {<a name="line.252"></a>
-<FONT color="green">253</FONT>                       token.reset();<a name="line.253"></a>
-<FONT color="green">254</FONT>                   }<a name="line.254"></a>
-<FONT color="green">255</FONT>                   lexer.nextToken(token);<a name="line.255"></a>
-<FONT color="green">256</FONT>                   switch(token.type) {<a name="line.256"></a>
-<FONT color="green">257</FONT>                   case EOF:<a name="line.257"></a>
-<FONT color="green">258</FONT>                       break;<a name="line.258"></a>
-<FONT color="green">259</FONT>                   case EORECORD:<a name="line.259"></a>
-<FONT color="green">260</FONT>                       fields++;<a name="line.260"></a>
-<FONT color="green">261</FONT>                       count++;<a name="line.261"></a>
-<FONT color="green">262</FONT>                       break;<a name="line.262"></a>
-<FONT color="green">263</FONT>                   case INVALID:<a name="line.263"></a>
-<FONT color="green">264</FONT>                       throw new IOException("invalid parse sequence &lt;"+token.content.toString()+"&gt;");<a name="line.264"></a>
-<FONT color="green">265</FONT>                   case TOKEN:<a name="line.265"></a>
-<FONT color="green">266</FONT>                       fields++;<a name="line.266"></a>
-<FONT color="green">267</FONT>                       break;<a name="line.267"></a>
-<FONT color="green">268</FONT>                    case COMMENT: // not really expecting these<a name="line.268"></a>
-<FONT color="green">269</FONT>                        break;<a name="line.269"></a>
-<FONT color="green">270</FONT>                  }<a name="line.270"></a>
-<FONT color="green">271</FONT>    <a name="line.271"></a>
-<FONT color="green">272</FONT>               } while (!token.type.equals(Token.Type.EOF));<a name="line.272"></a>
-<FONT color="green">273</FONT>               final Stats s = new Stats(count, fields);<a name="line.273"></a>
-<FONT color="green">274</FONT>               input.close();<a name="line.274"></a>
-<FONT color="green">275</FONT>               show(lexer.getClass().getSimpleName()+dynamic+" "+(newToken ? "new" : "reset"), s, t0);<a name="line.275"></a>
-<FONT color="green">276</FONT>           }<a name="line.276"></a>
-<FONT color="green">277</FONT>           show();<a name="line.277"></a>
-<FONT color="green">278</FONT>       }<a name="line.278"></a>
-<FONT color="green">279</FONT>    <a name="line.279"></a>
-<FONT color="green">280</FONT>       private static Stats iterate(final Iterable&lt;CSVRecord&gt; it) {<a name="line.280"></a>
-<FONT color="green">281</FONT>           int count = 0;<a name="line.281"></a>
-<FONT color="green">282</FONT>           int fields = 0;<a name="line.282"></a>
-<FONT color="green">283</FONT>           for (final CSVRecord record : it) {<a name="line.283"></a>
-<FONT color="green">284</FONT>               count++;<a name="line.284"></a>
-<FONT color="green">285</FONT>               fields+=record.size();<a name="line.285"></a>
-<FONT color="green">286</FONT>           }<a name="line.286"></a>
-<FONT color="green">287</FONT>           return new Stats(count, fields);<a name="line.287"></a>
-<FONT color="green">288</FONT>       }<a name="line.288"></a>
-<FONT color="green">289</FONT>    <a name="line.289"></a>
-<FONT color="green">290</FONT>    }<a name="line.290"></a>
+<FONT color="green">229</FONT>           final Class&lt;Lexer&gt; lexer = (Class&lt;Lexer&gt;) Class.forName("org.apache.commons.csv." + clazz);<a name="line.229"></a>
+<FONT color="green">230</FONT>           return lexer.getConstructor(new Class&lt;?&gt;[]{CSVFormat.class, ExtendedBufferedReader.class});<a name="line.230"></a>
+<FONT color="green">231</FONT>       }<a name="line.231"></a>
+<FONT color="green">232</FONT>    <a name="line.232"></a>
+<FONT color="green">233</FONT>       private static void testCSVLexer(final boolean newToken, final String test) throws Exception {<a name="line.233"></a>
+<FONT color="green">234</FONT>           Token token = new Token();<a name="line.234"></a>
+<FONT color="green">235</FONT>           String dynamic = "";<a name="line.235"></a>
+<FONT color="green">236</FONT>           for (int i = 0; i &lt; max; i++) {<a name="line.236"></a>
+<FONT color="green">237</FONT>               final ExtendedBufferedReader input = new ExtendedBufferedReader(getReader());<a name="line.237"></a>
+<FONT color="green">238</FONT>               Lexer lexer = null;<a name="line.238"></a>
+<FONT color="green">239</FONT>               if (test.startsWith("CSVLexer")) {<a name="line.239"></a>
+<FONT color="green">240</FONT>                   dynamic="!";<a name="line.240"></a>
+<FONT color="green">241</FONT>                   lexer = getLexerCtor(test).newInstance(new Object[]{format, input});<a name="line.241"></a>
+<FONT color="green">242</FONT>               } else {<a name="line.242"></a>
+<FONT color="green">243</FONT>                   lexer = new CSVLexer(format, input);<a name="line.243"></a>
+<FONT color="green">244</FONT>               }<a name="line.244"></a>
+<FONT color="green">245</FONT>               int count = 0;<a name="line.245"></a>
+<FONT color="green">246</FONT>               int fields = 0;<a name="line.246"></a>
+<FONT color="green">247</FONT>               final long t0 = System.currentTimeMillis();<a name="line.247"></a>
+<FONT color="green">248</FONT>               do {<a name="line.248"></a>
+<FONT color="green">249</FONT>                   if (newToken) {<a name="line.249"></a>
+<FONT color="green">250</FONT>                       token = new Token();<a name="line.250"></a>
+<FONT color="green">251</FONT>                   } else {<a name="line.251"></a>
+<FONT color="green">252</FONT>                       token.reset();<a name="line.252"></a>
+<FONT color="green">253</FONT>                   }<a name="line.253"></a>
+<FONT color="green">254</FONT>                   lexer.nextToken(token);<a name="line.254"></a>
+<FONT color="green">255</FONT>                   switch(token.type) {<a name="line.255"></a>
+<FONT color="green">256</FONT>                   case EOF:<a name="line.256"></a>
+<FONT color="green">257</FONT>                       break;<a name="line.257"></a>
+<FONT color="green">258</FONT>                   case EORECORD:<a name="line.258"></a>
+<FONT color="green">259</FONT>                       fields++;<a name="line.259"></a>
+<FONT color="green">260</FONT>                       count++;<a name="line.260"></a>
+<FONT color="green">261</FONT>                       break;<a name="line.261"></a>
+<FONT color="green">262</FONT>                   case INVALID:<a name="line.262"></a>
+<FONT color="green">263</FONT>                       throw new IOException("invalid parse sequence &lt;"+token.content.toString()+"&gt;");<a name="line.263"></a>
+<FONT color="green">264</FONT>                   case TOKEN:<a name="line.264"></a>
+<FONT color="green">265</FONT>                       fields++;<a name="line.265"></a>
+<FONT color="green">266</FONT>                       break;<a name="line.266"></a>
+<FONT color="green">267</FONT>                    case COMMENT: // not really expecting these<a name="line.267"></a>
+<FONT color="green">268</FONT>                        break;<a name="line.268"></a>
+<FONT color="green">269</FONT>                  }<a name="line.269"></a>
+<FONT color="green">270</FONT>    <a name="line.270"></a>
+<FONT color="green">271</FONT>               } while (!token.type.equals(Token.Type.EOF));<a name="line.271"></a>
+<FONT color="green">272</FONT>               final Stats s = new Stats(count, fields);<a name="line.272"></a>
+<FONT color="green">273</FONT>               input.close();<a name="line.273"></a>
+<FONT color="green">274</FONT>               show(lexer.getClass().getSimpleName()+dynamic+" "+(newToken ? "new" : "reset"), s, t0);<a name="line.274"></a>
+<FONT color="green">275</FONT>           }<a name="line.275"></a>
+<FONT color="green">276</FONT>           show();<a name="line.276"></a>
+<FONT color="green">277</FONT>       }<a name="line.277"></a>
+<FONT color="green">278</FONT>    <a name="line.278"></a>
+<FONT color="green">279</FONT>       private static Stats iterate(final Iterable&lt;CSVRecord&gt; it) {<a name="line.279"></a>
+<FONT color="green">280</FONT>           int count = 0;<a name="line.280"></a>
+<FONT color="green">281</FONT>           int fields = 0;<a name="line.281"></a>
+<FONT color="green">282</FONT>           for (final CSVRecord record : it) {<a name="line.282"></a>
+<FONT color="green">283</FONT>               count++;<a name="line.283"></a>
+<FONT color="green">284</FONT>               fields+=record.size();<a name="line.284"></a>
+<FONT color="green">285</FONT>           }<a name="line.285"></a>
+<FONT color="green">286</FONT>           return new Stats(count, fields);<a name="line.286"></a>
+<FONT color="green">287</FONT>       }<a name="line.287"></a>
+<FONT color="green">288</FONT>    <a name="line.288"></a>
+<FONT color="green">289</FONT>    }<a name="line.289"></a>
 
 
 

Modified: websites/production/commons/content/proper/commons-csv/xref-test/org/apache/commons/csv/CSVFileParserTest.html
==============================================================================
--- websites/production/commons/content/proper/commons-csv/xref-test/org/apache/commons/csv/CSVFileParserTest.html (original)
+++ websites/production/commons/content/proper/commons-csv/xref-test/org/apache/commons/csv/CSVFileParserTest.html Tue Mar 26 22:16:19 2013
@@ -101,17 +101,17 @@
 <a class="jxr_linenumber" name="91" href="#91">91</a>           <em class="jxr_comment">// first line starts with csv data file name</em>
 <a class="jxr_linenumber" name="92" href="#92">92</a>          <strong class="jxr_keyword">final</strong> BufferedReader csvFile = <strong class="jxr_keyword">new</strong> BufferedReader(<strong class="jxr_keyword">new</strong> FileReader(<strong class="jxr_keyword">new</strong> File(BASE, split[0])));
 <a class="jxr_linenumber" name="93" href="#93">93</a>          <strong class="jxr_keyword">final</strong> CSVFormatBuilder builder = CSVFormat.newBuilder(',').withQuoteChar('&quot;');
-<a class="jxr_linenumber" name="94" href="#94">94</a>          CSVFormat fmt = builder.build(); 
+<a class="jxr_linenumber" name="94" href="#94">94</a>          CSVFormat format = builder.build(); 
 <a class="jxr_linenumber" name="95" href="#95">95</a>          <strong class="jxr_keyword">boolean</strong> checkComments = false;
 <a class="jxr_linenumber" name="96" href="#96">96</a>          <strong class="jxr_keyword">for</strong>(<strong class="jxr_keyword">int</strong> i=1; i &lt; split.length; i++) {
 <a class="jxr_linenumber" name="97" href="#97">97</a>              <strong class="jxr_keyword">final</strong> String option = split[i];
 <a class="jxr_linenumber" name="98" href="#98">98</a>              <strong class="jxr_keyword">final</strong> String[] option_parts = option.split(<span class="jxr_string">"="</span>,2);
 <a class="jxr_linenumber" name="99" href="#99">99</a>              <strong class="jxr_keyword">if</strong> (<span class="jxr_string">"IgnoreEmpty"</span>.equalsIgnoreCase(option_parts[0])){
-<a class="jxr_linenumber" name="100" href="#100">100</a>                 fmt = builder.withIgnoreEmptyLines(Boolean.parseBoolean(option_parts[1])).build();
+<a class="jxr_linenumber" name="100" href="#100">100</a>                 format = builder.withIgnoreEmptyLines(Boolean.parseBoolean(option_parts[1])).build();
 <a class="jxr_linenumber" name="101" href="#101">101</a>             } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (<span class="jxr_string">"IgnoreSpaces"</span>.equalsIgnoreCase(option_parts[0])) {
-<a class="jxr_linenumber" name="102" href="#102">102</a>                 fmt = builder.withIgnoreSurroundingSpaces(Boolean.parseBoolean(option_parts[1])).build();
+<a class="jxr_linenumber" name="102" href="#102">102</a>                 format = builder.withIgnoreSurroundingSpaces(Boolean.parseBoolean(option_parts[1])).build();
 <a class="jxr_linenumber" name="103" href="#103">103</a>             } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (<span class="jxr_string">"CommentStart"</span>.equalsIgnoreCase(option_parts[0])) {
-<a class="jxr_linenumber" name="104" href="#104">104</a>                 fmt = builder.withCommentStart(option_parts[1].charAt(0)).build();
+<a class="jxr_linenumber" name="104" href="#104">104</a>                 format = builder.withCommentStart(option_parts[1].charAt(0)).build();
 <a class="jxr_linenumber" name="105" href="#105">105</a>             } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (<span class="jxr_string">"CheckComments"</span>.equalsIgnoreCase(option_parts[0])) {
 <a class="jxr_linenumber" name="106" href="#106">106</a>                 checkComments = <strong class="jxr_keyword">true</strong>;
 <a class="jxr_linenumber" name="107" href="#107">107</a>             } <strong class="jxr_keyword">else</strong> {
@@ -119,18 +119,18 @@
 <a class="jxr_linenumber" name="109" href="#109">109</a>             }
 <a class="jxr_linenumber" name="110" href="#110">110</a>         }
 <a class="jxr_linenumber" name="111" href="#111">111</a>         line = readTestData(); <em class="jxr_comment">// get string version of format</em>
-<a class="jxr_linenumber" name="112" href="#112">112</a>         assertEquals(testName+<span class="jxr_string">" Expected format "</span>, line, fmt.toString());
+<a class="jxr_linenumber" name="112" href="#112">112</a>         assertEquals(testName+<span class="jxr_string">" Expected format "</span>, line, format.toString());
 <a class="jxr_linenumber" name="113" href="#113">113</a> 
 <a class="jxr_linenumber" name="114" href="#114">114</a>         <em class="jxr_comment">// Now parse the file and compare against the expected results</em>
-<a class="jxr_linenumber" name="115" href="#115">115</a>         <strong class="jxr_keyword">for</strong>(<strong class="jxr_keyword">final</strong> CSVRecord rec : fmt.parse(csvFile)) {
-<a class="jxr_linenumber" name="116" href="#116">116</a>             String parsed = rec.toString();
+<a class="jxr_linenumber" name="115" href="#115">115</a>         <strong class="jxr_keyword">for</strong>(<strong class="jxr_keyword">final</strong> CSVRecord record : format.parse(csvFile)) {
+<a class="jxr_linenumber" name="116" href="#116">116</a>             String parsed = record.toString();
 <a class="jxr_linenumber" name="117" href="#117">117</a>             <strong class="jxr_keyword">if</strong> (checkComments) {
-<a class="jxr_linenumber" name="118" href="#118">118</a>                 <strong class="jxr_keyword">final</strong> String comment = rec.getComment().replace(<span class="jxr_string">"\n"</span>, <span class="jxr_string">"&#92;&#92;n"</span>);
+<a class="jxr_linenumber" name="118" href="#118">118</a>                 <strong class="jxr_keyword">final</strong> String comment = record.getComment().replace(<span class="jxr_string">"\n"</span>, <span class="jxr_string">"&#92;&#92;n"</span>);
 <a class="jxr_linenumber" name="119" href="#119">119</a>                 <strong class="jxr_keyword">if</strong> (comment != <strong class="jxr_keyword">null</strong>) {
 <a class="jxr_linenumber" name="120" href="#120">120</a>                     parsed += <span class="jxr_string">"#"</span> + comment;
 <a class="jxr_linenumber" name="121" href="#121">121</a>                 }
 <a class="jxr_linenumber" name="122" href="#122">122</a>             }
-<a class="jxr_linenumber" name="123" href="#123">123</a>             <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> count = rec.size();
+<a class="jxr_linenumber" name="123" href="#123">123</a>             <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> count = record.size();
 <a class="jxr_linenumber" name="124" href="#124">124</a>             assertEquals(testName, readTestData(), count+<span class="jxr_string">":"</span>+parsed);
 <a class="jxr_linenumber" name="125" href="#125">125</a>         }
 <a class="jxr_linenumber" name="126" href="#126">126</a>     }



Mime
View raw message