commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r855435 [27/45] - in /websites/production/commons/content/proper/commons-csv: ./ apidocs/ apidocs/org/apache/commons/csv/ apidocs/org/apache/commons/csv/class-use/ apidocs/org/apache/commons/csv/writer/ apidocs/src-html/org/apache/commons/c...
Date Thu, 21 Mar 2013 15:20:21 GMT
Added: websites/production/commons/content/proper/commons-csv/testapidocs/src-html/org/apache/commons/csv/CSVFileParserTest.html
==============================================================================
--- websites/production/commons/content/proper/commons-csv/testapidocs/src-html/org/apache/commons/csv/CSVFileParserTest.html (added)
+++ websites/production/commons/content/proper/commons-csv/testapidocs/src-html/org/apache/commons/csv/CSVFileParserTest.html Thu Mar 21 15:20:15 2013
@@ -0,0 +1,193 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.csv;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import static org.junit.Assert.assertEquals;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import static org.junit.Assert.assertNotNull;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import static org.junit.Assert.assertTrue;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import static org.junit.Assert.fail;<a name="line.23"></a>
+<FONT color="green">024</FONT>    <a name="line.24"></a>
+<FONT color="green">025</FONT>    import java.io.BufferedReader;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import java.io.File;<a name="line.26"></a>
+<FONT color="green">027</FONT>    import java.io.FileNotFoundException;<a name="line.27"></a>
+<FONT color="green">028</FONT>    import java.io.FileReader;<a name="line.28"></a>
+<FONT color="green">029</FONT>    import java.io.FilenameFilter;<a name="line.29"></a>
+<FONT color="green">030</FONT>    import java.io.IOException;<a name="line.30"></a>
+<FONT color="green">031</FONT>    import java.util.ArrayList;<a name="line.31"></a>
+<FONT color="green">032</FONT>    import java.util.Collection;<a name="line.32"></a>
+<FONT color="green">033</FONT>    import java.util.List;<a name="line.33"></a>
+<FONT color="green">034</FONT>    <a name="line.34"></a>
+<FONT color="green">035</FONT>    import org.apache.commons.csv.CSVFormat.CSVFormatBuilder;<a name="line.35"></a>
+<FONT color="green">036</FONT>    import org.junit.Test;<a name="line.36"></a>
+<FONT color="green">037</FONT>    import org.junit.runner.RunWith;<a name="line.37"></a>
+<FONT color="green">038</FONT>    import org.junit.runners.Parameterized;<a name="line.38"></a>
+<FONT color="green">039</FONT>    import org.junit.runners.Parameterized.Parameters;<a name="line.39"></a>
+<FONT color="green">040</FONT>    <a name="line.40"></a>
+<FONT color="green">041</FONT>    /**<a name="line.41"></a>
+<FONT color="green">042</FONT>     * Parse tests using test files<a name="line.42"></a>
+<FONT color="green">043</FONT>     *<a name="line.43"></a>
+<FONT color="green">044</FONT>     * @version $Id$<a name="line.44"></a>
+<FONT color="green">045</FONT>     */<a name="line.45"></a>
+<FONT color="green">046</FONT>    @RunWith(Parameterized.class)<a name="line.46"></a>
+<FONT color="green">047</FONT>    public class CSVFileParserTest {<a name="line.47"></a>
+<FONT color="green">048</FONT>    <a name="line.48"></a>
+<FONT color="green">049</FONT>        private static final File BASE = new File("src/test/resources/CSVFileParser");<a name="line.49"></a>
+<FONT color="green">050</FONT>    <a name="line.50"></a>
+<FONT color="green">051</FONT>        private final BufferedReader testData;<a name="line.51"></a>
+<FONT color="green">052</FONT>        private final String testName;<a name="line.52"></a>
+<FONT color="green">053</FONT>    <a name="line.53"></a>
+<FONT color="green">054</FONT>        public CSVFileParserTest(final File file) throws FileNotFoundException<a name="line.54"></a>
+<FONT color="green">055</FONT>        {<a name="line.55"></a>
+<FONT color="green">056</FONT>           this.testName = file.getName();<a name="line.56"></a>
+<FONT color="green">057</FONT>           this.testData = new BufferedReader(new FileReader(file));<a name="line.57"></a>
+<FONT color="green">058</FONT>        }<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>        private String readTestData() throws IOException {<a name="line.60"></a>
+<FONT color="green">061</FONT>            String line;<a name="line.61"></a>
+<FONT color="green">062</FONT>            do {<a name="line.62"></a>
+<FONT color="green">063</FONT>                line = testData.readLine();<a name="line.63"></a>
+<FONT color="green">064</FONT>            } while (line != null &amp;&amp; line.startsWith("#"));<a name="line.64"></a>
+<FONT color="green">065</FONT>            return line;<a name="line.65"></a>
+<FONT color="green">066</FONT>        }<a name="line.66"></a>
+<FONT color="green">067</FONT>    <a name="line.67"></a>
+<FONT color="green">068</FONT>        @Parameters<a name="line.68"></a>
+<FONT color="green">069</FONT>        public static Collection&lt;Object[]&gt; generateData()<a name="line.69"></a>
+<FONT color="green">070</FONT>        {<a name="line.70"></a>
+<FONT color="green">071</FONT>            final List&lt;Object[]&gt; list = new ArrayList&lt;Object[]&gt;();<a name="line.71"></a>
+<FONT color="green">072</FONT>    <a name="line.72"></a>
+<FONT color="green">073</FONT>            final FilenameFilter filenameFilter = new FilenameFilter() {<a name="line.73"></a>
+<FONT color="green">074</FONT>                public boolean accept(final File dir, final String name) {<a name="line.74"></a>
+<FONT color="green">075</FONT>                    return name.startsWith("test") &amp;&amp; name.endsWith(".txt");<a name="line.75"></a>
+<FONT color="green">076</FONT>                }<a name="line.76"></a>
+<FONT color="green">077</FONT>            };<a name="line.77"></a>
+<FONT color="green">078</FONT>            final File[] files = BASE.listFiles(filenameFilter);<a name="line.78"></a>
+<FONT color="green">079</FONT>            for(final File f : files){<a name="line.79"></a>
+<FONT color="green">080</FONT>                list.add(new Object[]{f});<a name="line.80"></a>
+<FONT color="green">081</FONT>            }<a name="line.81"></a>
+<FONT color="green">082</FONT>            return list;<a name="line.82"></a>
+<FONT color="green">083</FONT>        }<a name="line.83"></a>
+<FONT color="green">084</FONT>    <a name="line.84"></a>
+<FONT color="green">085</FONT>        @Test<a name="line.85"></a>
+<FONT color="green">086</FONT>        public void testCSVFile() throws Exception {<a name="line.86"></a>
+<FONT color="green">087</FONT>            String line = readTestData();<a name="line.87"></a>
+<FONT color="green">088</FONT>            assertNotNull("file must contain config line", line);<a name="line.88"></a>
+<FONT color="green">089</FONT>            final String[] split = line.split(" ");<a name="line.89"></a>
+<FONT color="green">090</FONT>            assertTrue(testName+" require 1 param", split.length &gt;= 1);<a name="line.90"></a>
+<FONT color="green">091</FONT>             // first line starts with csv data file name<a name="line.91"></a>
+<FONT color="green">092</FONT>            final BufferedReader csvFile = new BufferedReader(new FileReader(new File(BASE, split[0])));<a name="line.92"></a>
+<FONT color="green">093</FONT>            final CSVFormatBuilder builder = CSVFormat.newBuilder(',').withQuoteChar('"');<a name="line.93"></a>
+<FONT color="green">094</FONT>            CSVFormat fmt = builder.build(); <a name="line.94"></a>
+<FONT color="green">095</FONT>            boolean checkComments = false;<a name="line.95"></a>
+<FONT color="green">096</FONT>            for(int i=1; i &lt; split.length; i++) {<a name="line.96"></a>
+<FONT color="green">097</FONT>                final String option = split[i];<a name="line.97"></a>
+<FONT color="green">098</FONT>                final String[] option_parts = option.split("=",2);<a name="line.98"></a>
+<FONT color="green">099</FONT>                if ("IgnoreEmpty".equalsIgnoreCase(option_parts[0])){<a name="line.99"></a>
+<FONT color="green">100</FONT>                    fmt = builder.withIgnoreEmptyLines(Boolean.parseBoolean(option_parts[1])).build();<a name="line.100"></a>
+<FONT color="green">101</FONT>                } else if ("IgnoreSpaces".equalsIgnoreCase(option_parts[0])) {<a name="line.101"></a>
+<FONT color="green">102</FONT>                    fmt = builder.withIgnoreSurroundingSpaces(Boolean.parseBoolean(option_parts[1])).build();<a name="line.102"></a>
+<FONT color="green">103</FONT>                } else if ("CommentStart".equalsIgnoreCase(option_parts[0])) {<a name="line.103"></a>
+<FONT color="green">104</FONT>                    fmt = builder.withCommentStart(option_parts[1].charAt(0)).build();<a name="line.104"></a>
+<FONT color="green">105</FONT>                } else if ("CheckComments".equalsIgnoreCase(option_parts[0])) {<a name="line.105"></a>
+<FONT color="green">106</FONT>                    checkComments = true;<a name="line.106"></a>
+<FONT color="green">107</FONT>                } else {<a name="line.107"></a>
+<FONT color="green">108</FONT>                    fail(testName+" unexpected option: "+option);<a name="line.108"></a>
+<FONT color="green">109</FONT>                }<a name="line.109"></a>
+<FONT color="green">110</FONT>            }<a name="line.110"></a>
+<FONT color="green">111</FONT>            line = readTestData(); // get string version of format<a name="line.111"></a>
+<FONT color="green">112</FONT>            assertEquals(testName+" Expected format ", line, fmt.toString());<a name="line.112"></a>
+<FONT color="green">113</FONT>    <a name="line.113"></a>
+<FONT color="green">114</FONT>            // Now parse the file and compare against the expected results<a name="line.114"></a>
+<FONT color="green">115</FONT>            for(final CSVRecord rec : fmt.parse(csvFile)) {<a name="line.115"></a>
+<FONT color="green">116</FONT>                String parsed = rec.toString();<a name="line.116"></a>
+<FONT color="green">117</FONT>                if (checkComments) {<a name="line.117"></a>
+<FONT color="green">118</FONT>                    final String comment = rec.getComment().replace("\n", "\\n");<a name="line.118"></a>
+<FONT color="green">119</FONT>                    if (comment != null) {<a name="line.119"></a>
+<FONT color="green">120</FONT>                        parsed += "#" + comment;<a name="line.120"></a>
+<FONT color="green">121</FONT>                    }<a name="line.121"></a>
+<FONT color="green">122</FONT>                }<a name="line.122"></a>
+<FONT color="green">123</FONT>                final int count = rec.size();<a name="line.123"></a>
+<FONT color="green">124</FONT>                assertEquals(testName, readTestData(), count+":"+parsed);<a name="line.124"></a>
+<FONT color="green">125</FONT>            }<a name="line.125"></a>
+<FONT color="green">126</FONT>        }<a name="line.126"></a>
+<FONT color="green">127</FONT>    }<a name="line.127"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
\ No newline at end of file

Propchange: websites/production/commons/content/proper/commons-csv/testapidocs/src-html/org/apache/commons/csv/CSVFileParserTest.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: websites/production/commons/content/proper/commons-csv/testapidocs/src-html/org/apache/commons/csv/CSVFileParserTest.html
------------------------------------------------------------------------------
    svn:keywords = Id

Added: websites/production/commons/content/proper/commons-csv/testapidocs/src-html/org/apache/commons/csv/CSVFormatBuilderTest.html
==============================================================================
--- websites/production/commons/content/proper/commons-csv/testapidocs/src-html/org/apache/commons/csv/CSVFormatBuilderTest.html (added)
+++ websites/production/commons/content/proper/commons-csv/testapidocs/src-html/org/apache/commons/csv/CSVFormatBuilderTest.html Thu Mar 21 15:20:15 2013
@@ -0,0 +1,258 @@
+<HTML>
+<BODY BGCOLOR="white">
+<PRE>
+<FONT color="green">001</FONT>    /*<a name="line.1"></a>
+<FONT color="green">002</FONT>     * Licensed to the Apache Software Foundation (ASF) under one or more<a name="line.2"></a>
+<FONT color="green">003</FONT>     * contributor license agreements.  See the NOTICE file distributed with<a name="line.3"></a>
+<FONT color="green">004</FONT>     * this work for additional information regarding copyright ownership.<a name="line.4"></a>
+<FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
+<FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
+<FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
+<FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
+<FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
+<FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
+<FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
+<FONT color="green">014</FONT>     * See the License for the specific language governing permissions and<a name="line.14"></a>
+<FONT color="green">015</FONT>     * limitations under the License.<a name="line.15"></a>
+<FONT color="green">016</FONT>     */<a name="line.16"></a>
+<FONT color="green">017</FONT>    <a name="line.17"></a>
+<FONT color="green">018</FONT>    package org.apache.commons.csv;<a name="line.18"></a>
+<FONT color="green">019</FONT>    <a name="line.19"></a>
+<FONT color="green">020</FONT>    import static org.apache.commons.csv.CSVFormat.RFC4180;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import static org.apache.commons.csv.Constants.CR;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import static org.apache.commons.csv.Constants.CRLF;<a name="line.22"></a>
+<FONT color="green">023</FONT>    import static org.apache.commons.csv.Constants.LF;<a name="line.23"></a>
+<FONT color="green">024</FONT>    import static org.junit.Assert.assertEquals;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import static org.junit.Assert.assertFalse;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import static org.junit.Assert.assertNotSame;<a name="line.26"></a>
+<FONT color="green">027</FONT>    import static org.junit.Assert.assertTrue;<a name="line.27"></a>
+<FONT color="green">028</FONT>    <a name="line.28"></a>
+<FONT color="green">029</FONT>    import org.apache.commons.csv.CSVFormat.CSVFormatBuilder;<a name="line.29"></a>
+<FONT color="green">030</FONT>    import org.junit.Before;<a name="line.30"></a>
+<FONT color="green">031</FONT>    import org.junit.Test;<a name="line.31"></a>
+<FONT color="green">032</FONT>    <a name="line.32"></a>
+<FONT color="green">033</FONT>    /**<a name="line.33"></a>
+<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>     * @version $Id$<a name="line.36"></a>
+<FONT color="green">037</FONT>     */<a name="line.37"></a>
+<FONT color="green">038</FONT>    public class CSVFormatBuilderTest {<a name="line.38"></a>
+<FONT color="green">039</FONT>    <a name="line.39"></a>
+<FONT color="green">040</FONT>        private CSVFormatBuilder builder;<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>        @Before<a name="line.42"></a>
+<FONT color="green">043</FONT>        public void setUp() throws Exception {<a name="line.43"></a>
+<FONT color="green">044</FONT>            builder = new CSVFormatBuilder('+', Character.valueOf('!'), null, Character.valueOf('#'), Character.valueOf('!'), true, true, CRLF, null);<a name="line.44"></a>
+<FONT color="green">045</FONT>        }<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        @Test<a name="line.47"></a>
+<FONT color="green">048</FONT>        public void testCommentStart() {<a name="line.48"></a>
+<FONT color="green">049</FONT>            assertEquals('?', builder.withCommentStart('?').build().getCommentStart().charValue());<a name="line.49"></a>
+<FONT color="green">050</FONT>        }<a name="line.50"></a>
+<FONT color="green">051</FONT>        <a name="line.51"></a>
+<FONT color="green">052</FONT>        @Test<a name="line.52"></a>
+<FONT color="green">053</FONT>        public void testCopiedFormatIsEqualToOriginal() {<a name="line.53"></a>
+<FONT color="green">054</FONT>            final CSVFormat copyOfRCF4180 = CSVFormat.newBuilder(RFC4180).build();<a name="line.54"></a>
+<FONT color="green">055</FONT>            assertEquals(RFC4180, copyOfRCF4180);<a name="line.55"></a>
+<FONT color="green">056</FONT>        }<a name="line.56"></a>
+<FONT color="green">057</FONT>    <a name="line.57"></a>
+<FONT color="green">058</FONT>        @Test<a name="line.58"></a>
+<FONT color="green">059</FONT>        public void testCopiedFormatWithChanges() {<a name="line.59"></a>
+<FONT color="green">060</FONT>            final CSVFormat newFormat = CSVFormat.newBuilder(RFC4180).withDelimiter('!').build();<a name="line.60"></a>
+<FONT color="green">061</FONT>            assertTrue(newFormat.getDelimiter() != RFC4180.getDelimiter());<a name="line.61"></a>
+<FONT color="green">062</FONT>        }<a name="line.62"></a>
+<FONT color="green">063</FONT>        <a name="line.63"></a>
+<FONT color="green">064</FONT>        @Test<a name="line.64"></a>
+<FONT color="green">065</FONT>        public void testDelimiter() {<a name="line.65"></a>
+<FONT color="green">066</FONT>            assertEquals('?', builder.withDelimiter('?').build().getDelimiter());<a name="line.66"></a>
+<FONT color="green">067</FONT>        }<a name="line.67"></a>
+<FONT color="green">068</FONT>        <a name="line.68"></a>
+<FONT color="green">069</FONT>        @Test(expected = IllegalStateException.class)<a name="line.69"></a>
+<FONT color="green">070</FONT>        public void testDelimiterSameAsCommentStartThrowsException() {<a name="line.70"></a>
+<FONT color="green">071</FONT>            builder.withDelimiter('!').withCommentStart('!').build();<a name="line.71"></a>
+<FONT color="green">072</FONT>        }<a name="line.72"></a>
+<FONT color="green">073</FONT>    <a name="line.73"></a>
+<FONT color="green">074</FONT>        @Test(expected = IllegalStateException.class)<a name="line.74"></a>
+<FONT color="green">075</FONT>        public void testDelimiterSameAsEscapeThrowsException() {<a name="line.75"></a>
+<FONT color="green">076</FONT>            builder.withDelimiter('!').withEscape('!').build();<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>        @Test<a name="line.79"></a>
+<FONT color="green">080</FONT>        public void testEscape() {<a name="line.80"></a>
+<FONT color="green">081</FONT>            assertEquals('?', builder.withEscape('?').build().getEscape().charValue());<a name="line.81"></a>
+<FONT color="green">082</FONT>        }<a name="line.82"></a>
+<FONT color="green">083</FONT>        <a name="line.83"></a>
+<FONT color="green">084</FONT>        @Test(expected = IllegalStateException.class)<a name="line.84"></a>
+<FONT color="green">085</FONT>        public void testEscapeSameAsCommentStartThrowsException() {<a name="line.85"></a>
+<FONT color="green">086</FONT>            builder.withEscape('!').withCommentStart('!').build();<a name="line.86"></a>
+<FONT color="green">087</FONT>        }<a name="line.87"></a>
+<FONT color="green">088</FONT>    <a name="line.88"></a>
+<FONT color="green">089</FONT>        @Test(expected = IllegalStateException.class)<a name="line.89"></a>
+<FONT color="green">090</FONT>        public void testEscapeSameAsCommentStartThrowsExceptionForWrapperType() {<a name="line.90"></a>
+<FONT color="green">091</FONT>            // Cannot assume that callers won't use different Character objects<a name="line.91"></a>
+<FONT color="green">092</FONT>            builder.withEscape(new Character('!')).withCommentStart(new Character('!')).build();<a name="line.92"></a>
+<FONT color="green">093</FONT>        }<a name="line.93"></a>
+<FONT color="green">094</FONT>    <a name="line.94"></a>
+<FONT color="green">095</FONT>        @Test<a name="line.95"></a>
+<FONT color="green">096</FONT>        public void testHeaderReferenceCannotEscape() {<a name="line.96"></a>
+<FONT color="green">097</FONT>            final String[] header = new String[]{"one", "tow", "three"};<a name="line.97"></a>
+<FONT color="green">098</FONT>            builder.withHeader(header);<a name="line.98"></a>
+<FONT color="green">099</FONT>            <a name="line.99"></a>
+<FONT color="green">100</FONT>            final CSVFormat firstFormat = builder.build();<a name="line.100"></a>
+<FONT color="green">101</FONT>            final CSVFormat secondFormat = builder.build();<a name="line.101"></a>
+<FONT color="green">102</FONT>            assertNotSame(header, firstFormat.getHeader());<a name="line.102"></a>
+<FONT color="green">103</FONT>            assertNotSame(firstFormat, secondFormat.getHeader());<a name="line.103"></a>
+<FONT color="green">104</FONT>        }<a name="line.104"></a>
+<FONT color="green">105</FONT>    <a name="line.105"></a>
+<FONT color="green">106</FONT>        @Test<a name="line.106"></a>
+<FONT color="green">107</FONT>        public void testIgnoreEmptyLines() {<a name="line.107"></a>
+<FONT color="green">108</FONT>            assertFalse(builder.withIgnoreEmptyLines(false).build().getIgnoreEmptyLines());<a name="line.108"></a>
+<FONT color="green">109</FONT>        }<a name="line.109"></a>
+<FONT color="green">110</FONT>    <a name="line.110"></a>
+<FONT color="green">111</FONT>        @Test<a name="line.111"></a>
+<FONT color="green">112</FONT>        public void testIgnoreSurroundingSpaces() {<a name="line.112"></a>
+<FONT color="green">113</FONT>            assertFalse(builder.withIgnoreSurroundingSpaces(false).build().getIgnoreSurroundingSpaces());<a name="line.113"></a>
+<FONT color="green">114</FONT>        }<a name="line.114"></a>
+<FONT color="green">115</FONT>        <a name="line.115"></a>
+<FONT color="green">116</FONT>        @Test(expected = IllegalArgumentException.class)<a name="line.116"></a>
+<FONT color="green">117</FONT>        public void testNewFormatCRThrowsException() {<a name="line.117"></a>
+<FONT color="green">118</FONT>            CSVFormat.newBuilder(CR);<a name="line.118"></a>
+<FONT color="green">119</FONT>        }<a name="line.119"></a>
+<FONT color="green">120</FONT>    <a name="line.120"></a>
+<FONT color="green">121</FONT>        @Test(expected = IllegalArgumentException.class)<a name="line.121"></a>
+<FONT color="green">122</FONT>        public void testNewFormatLFThrowsException() {<a name="line.122"></a>
+<FONT color="green">123</FONT>            CSVFormat.newBuilder(LF);<a name="line.123"></a>
+<FONT color="green">124</FONT>        }<a name="line.124"></a>
+<FONT color="green">125</FONT>        <a name="line.125"></a>
+<FONT color="green">126</FONT>        @Test<a name="line.126"></a>
+<FONT color="green">127</FONT>        public void testQuoteChar() {<a name="line.127"></a>
+<FONT color="green">128</FONT>            assertEquals('?', builder.withQuoteChar('?').build().getQuoteChar().charValue());<a name="line.128"></a>
+<FONT color="green">129</FONT>        }<a name="line.129"></a>
+<FONT color="green">130</FONT>    <a name="line.130"></a>
+<FONT color="green">131</FONT>        @Test(expected = IllegalStateException.class)<a name="line.131"></a>
+<FONT color="green">132</FONT>        public void testQuoteCharSameAsCommentStartThrowsException() {<a name="line.132"></a>
+<FONT color="green">133</FONT>            builder.withQuoteChar('!').withCommentStart('!').build();<a name="line.133"></a>
+<FONT color="green">134</FONT>        }<a name="line.134"></a>
+<FONT color="green">135</FONT>        <a name="line.135"></a>
+<FONT color="green">136</FONT>        @Test(expected = IllegalStateException.class)<a name="line.136"></a>
+<FONT color="green">137</FONT>        public void testQuoteCharSameAsCommentStartThrowsExceptionForWrapperType() {<a name="line.137"></a>
+<FONT color="green">138</FONT>            // Cannot assume that callers won't use different Character objects<a name="line.138"></a>
+<FONT color="green">139</FONT>            builder.withQuoteChar(new Character('!')).withCommentStart('!').build();<a name="line.139"></a>
+<FONT color="green">140</FONT>        }<a name="line.140"></a>
+<FONT color="green">141</FONT>    <a name="line.141"></a>
+<FONT color="green">142</FONT>        @Test(expected = IllegalStateException.class)<a name="line.142"></a>
+<FONT color="green">143</FONT>        public void testQuoteCharSameAsDelimiterThrowsException() {<a name="line.143"></a>
+<FONT color="green">144</FONT>            builder.withQuoteChar('!').withDelimiter('!').build();<a name="line.144"></a>
+<FONT color="green">145</FONT>        }<a name="line.145"></a>
+<FONT color="green">146</FONT>    <a name="line.146"></a>
+<FONT color="green">147</FONT>        @Test<a name="line.147"></a>
+<FONT color="green">148</FONT>        public void testQuotePolicy() {<a name="line.148"></a>
+<FONT color="green">149</FONT>            assertEquals(Quote.ALL, builder.withQuotePolicy(Quote.ALL).build().getQuotePolicy());<a name="line.149"></a>
+<FONT color="green">150</FONT>        }<a name="line.150"></a>
+<FONT color="green">151</FONT>    <a name="line.151"></a>
+<FONT color="green">152</FONT>        @Test(expected = IllegalStateException.class)<a name="line.152"></a>
+<FONT color="green">153</FONT>        public void testQuotePolicyNoneWithoutEscapeThrowsException() {<a name="line.153"></a>
+<FONT color="green">154</FONT>            CSVFormat.newBuilder('!').withQuotePolicy(Quote.NONE).build();<a name="line.154"></a>
+<FONT color="green">155</FONT>        }<a name="line.155"></a>
+<FONT color="green">156</FONT>    <a name="line.156"></a>
+<FONT color="green">157</FONT>        @Test<a name="line.157"></a>
+<FONT color="green">158</FONT>        public void testRecoardSeparator() {<a name="line.158"></a>
+<FONT color="green">159</FONT>            assertEquals("?", builder.withRecordSeparator("?").build().getRecordSeparator());<a name="line.159"></a>
+<FONT color="green">160</FONT>        }<a name="line.160"></a>
+<FONT color="green">161</FONT>        <a name="line.161"></a>
+<FONT color="green">162</FONT>        @Test<a name="line.162"></a>
+<FONT color="green">163</FONT>        public void testRFC4180() {<a name="line.163"></a>
+<FONT color="green">164</FONT>            assertEquals(null, RFC4180.getCommentStart());<a name="line.164"></a>
+<FONT color="green">165</FONT>            assertEquals(',', RFC4180.getDelimiter());<a name="line.165"></a>
+<FONT color="green">166</FONT>            assertEquals(null, RFC4180.getEscape());<a name="line.166"></a>
+<FONT color="green">167</FONT>            assertEquals(false, RFC4180.getIgnoreEmptyLines());<a name="line.167"></a>
+<FONT color="green">168</FONT>            assertEquals(Character.valueOf('"'), RFC4180.getQuoteChar());<a name="line.168"></a>
+<FONT color="green">169</FONT>            assertEquals(null, RFC4180.getQuotePolicy());<a name="line.169"></a>
+<FONT color="green">170</FONT>            assertEquals("\r\n", RFC4180.getRecordSeparator());<a name="line.170"></a>
+<FONT color="green">171</FONT>        }<a name="line.171"></a>
+<FONT color="green">172</FONT>        <a name="line.172"></a>
+<FONT color="green">173</FONT>        @Test(expected = IllegalArgumentException.class)<a name="line.173"></a>
+<FONT color="green">174</FONT>        public void testWithCommentStartCRThrowsException() {<a name="line.174"></a>
+<FONT color="green">175</FONT>            builder.withCommentStart(CR).build();<a name="line.175"></a>
+<FONT color="green">176</FONT>        }<a name="line.176"></a>
+<FONT color="green">177</FONT>    <a name="line.177"></a>
+<FONT color="green">178</FONT>        @Test(expected = IllegalArgumentException.class)<a name="line.178"></a>
+<FONT color="green">179</FONT>        public void testWithDelimiterLFThrowsException() {<a name="line.179"></a>
+<FONT color="green">180</FONT>            builder.withDelimiter(LF).build();<a name="line.180"></a>
+<FONT color="green">181</FONT>        }<a name="line.181"></a>
+<FONT color="green">182</FONT>    <a name="line.182"></a>
+<FONT color="green">183</FONT>        @Test(expected = IllegalArgumentException.class)<a name="line.183"></a>
+<FONT color="green">184</FONT>        public void testWithEscapeCRThrowsExceptions() {<a name="line.184"></a>
+<FONT color="green">185</FONT>            builder.withEscape(CR).build();<a name="line.185"></a>
+<FONT color="green">186</FONT>        }<a name="line.186"></a>
+<FONT color="green">187</FONT>        <a name="line.187"></a>
+<FONT color="green">188</FONT>        @Test(expected = IllegalArgumentException.class)<a name="line.188"></a>
+<FONT color="green">189</FONT>        public void testWithQuoteLFThrowsException() {<a name="line.189"></a>
+<FONT color="green">190</FONT>            builder.withQuoteChar(LF).build();<a name="line.190"></a>
+<FONT color="green">191</FONT>        }<a name="line.191"></a>
+<FONT color="green">192</FONT>    }<a name="line.192"></a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+</BODY>
+</HTML>
\ No newline at end of file

Propchange: websites/production/commons/content/proper/commons-csv/testapidocs/src-html/org/apache/commons/csv/CSVFormatBuilderTest.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: websites/production/commons/content/proper/commons-csv/testapidocs/src-html/org/apache/commons/csv/CSVFormatBuilderTest.html
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: websites/production/commons/content/proper/commons-csv/testapidocs/src-html/org/apache/commons/csv/CSVFormatTest.html
==============================================================================
--- websites/production/commons/content/proper/commons-csv/testapidocs/src-html/org/apache/commons/csv/CSVFormatTest.html (original)
+++ websites/production/commons/content/proper/commons-csv/testapidocs/src-html/org/apache/commons/csv/CSVFormatTest.html Thu Mar 21 15:20:15 2013
@@ -8,9 +8,9 @@
 <FONT color="green">005</FONT>     * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
 <FONT color="green">006</FONT>     * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
 <FONT color="green">007</FONT>     * the License.  You may obtain a copy of the License at<a name="line.7"></a>
-<FONT color="green">008</FONT>     * <a name="line.8"></a>
+<FONT color="green">008</FONT>     *<a name="line.8"></a>
 <FONT color="green">009</FONT>     *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
-<FONT color="green">010</FONT>     * <a name="line.10"></a>
+<FONT color="green">010</FONT>     *<a name="line.10"></a>
 <FONT color="green">011</FONT>     * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
 <FONT color="green">012</FONT>     * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
 <FONT color="green">013</FONT>     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
@@ -20,134 +20,205 @@
 <FONT color="green">017</FONT>    <a name="line.17"></a>
 <FONT color="green">018</FONT>    package org.apache.commons.csv;<a name="line.18"></a>
 <FONT color="green">019</FONT>    <a name="line.19"></a>
-<FONT color="green">020</FONT>    import junit.framework.TestCase;<a name="line.20"></a>
-<FONT color="green">021</FONT>    <a name="line.21"></a>
-<FONT color="green">022</FONT>    public class CSVFormatTest extends TestCase {<a name="line.22"></a>
+<FONT color="green">020</FONT>    import static org.junit.Assert.assertEquals;<a name="line.20"></a>
+<FONT color="green">021</FONT>    import static org.junit.Assert.assertFalse;<a name="line.21"></a>
+<FONT color="green">022</FONT>    import static org.junit.Assert.assertNotNull;<a name="line.22"></a>
 <FONT color="green">023</FONT>    <a name="line.23"></a>
-<FONT color="green">024</FONT>        public void testImmutalibity() {<a name="line.24"></a>
-<FONT color="green">025</FONT>            CSVFormat format = new CSVFormat('!', '!', '!', '!', true, true, true, true);<a name="line.25"></a>
-<FONT color="green">026</FONT>            <a name="line.26"></a>
-<FONT color="green">027</FONT>            format.withDelimiter('?');<a name="line.27"></a>
-<FONT color="green">028</FONT>            format.withEncapsulator('?');<a name="line.28"></a>
-<FONT color="green">029</FONT>            format.withCommentStart('?');<a name="line.29"></a>
-<FONT color="green">030</FONT>            format.withLineSeparator("?");<a name="line.30"></a>
-<FONT color="green">031</FONT>            format.withEscape('?');<a name="line.31"></a>
-<FONT color="green">032</FONT>            format.withLeadingSpacesIgnored(false);<a name="line.32"></a>
-<FONT color="green">033</FONT>            format.withTrailingSpacesIgnored(false);<a name="line.33"></a>
-<FONT color="green">034</FONT>            format.withEmptyLinesIgnored(false);<a name="line.34"></a>
-<FONT color="green">035</FONT>            format.withUnicodeEscapesInterpreted(false);<a name="line.35"></a>
-<FONT color="green">036</FONT>            <a name="line.36"></a>
-<FONT color="green">037</FONT>            assertEquals('!', format.getDelimiter());<a name="line.37"></a>
-<FONT color="green">038</FONT>            assertEquals('!', format.getEncapsulator());<a name="line.38"></a>
-<FONT color="green">039</FONT>            assertEquals('!', format.getCommentStart());<a name="line.39"></a>
-<FONT color="green">040</FONT>            assertEquals('!', format.getEscape());<a name="line.40"></a>
-<FONT color="green">041</FONT>            assertEquals("\r\n", format.getLineSeparator());<a name="line.41"></a>
-<FONT color="green">042</FONT>            <a name="line.42"></a>
-<FONT color="green">043</FONT>            assertEquals(true, format.isLeadingSpacesIgnored());<a name="line.43"></a>
-<FONT color="green">044</FONT>            assertEquals(true, format.isTrailingSpacesIgnored());<a name="line.44"></a>
-<FONT color="green">045</FONT>            assertEquals(true, format.isEmptyLinesIgnored());<a name="line.45"></a>
-<FONT color="green">046</FONT>            assertEquals(true, format.isUnicodeEscapesInterpreted());<a name="line.46"></a>
-<FONT color="green">047</FONT>        }<a name="line.47"></a>
-<FONT color="green">048</FONT>    <a name="line.48"></a>
-<FONT color="green">049</FONT>        public void testMutators() {<a name="line.49"></a>
-<FONT color="green">050</FONT>            CSVFormat format = new CSVFormat('!', '!', '!', '!', true, true, true, true);<a name="line.50"></a>
-<FONT color="green">051</FONT>            <a name="line.51"></a>
-<FONT color="green">052</FONT>            assertEquals('?', format.withDelimiter('?').getDelimiter());<a name="line.52"></a>
-<FONT color="green">053</FONT>            assertEquals('?', format.withEncapsulator('?').getEncapsulator());<a name="line.53"></a>
-<FONT color="green">054</FONT>            assertEquals('?', format.withCommentStart('?').getCommentStart());<a name="line.54"></a>
-<FONT color="green">055</FONT>            assertEquals("?", format.withLineSeparator("?").getLineSeparator());<a name="line.55"></a>
-<FONT color="green">056</FONT>            assertEquals('?', format.withEscape('?').getEscape());<a name="line.56"></a>
-<FONT color="green">057</FONT>            <a name="line.57"></a>
-<FONT color="green">058</FONT>            assertEquals(false, format.withLeadingSpacesIgnored(false).isLeadingSpacesIgnored());<a name="line.58"></a>
-<FONT color="green">059</FONT>            assertEquals(false, format.withTrailingSpacesIgnored(false).isTrailingSpacesIgnored());<a name="line.59"></a>
-<FONT color="green">060</FONT>            assertEquals(false, format.withSurroundingSpacesIgnored(false).isLeadingSpacesIgnored());<a name="line.60"></a>
-<FONT color="green">061</FONT>            assertEquals(false, format.withSurroundingSpacesIgnored(false).isTrailingSpacesIgnored());<a name="line.61"></a>
-<FONT color="green">062</FONT>            assertEquals(false, format.withEmptyLinesIgnored(false).isEmptyLinesIgnored());<a name="line.62"></a>
-<FONT color="green">063</FONT>            assertEquals(false, format.withUnicodeEscapesInterpreted(false).isUnicodeEscapesInterpreted());<a name="line.63"></a>
-<FONT color="green">064</FONT>        }<a name="line.64"></a>
-<FONT color="green">065</FONT>    <a name="line.65"></a>
-<FONT color="green">066</FONT>        public void testFormat() {<a name="line.66"></a>
-<FONT color="green">067</FONT>            CSVFormat format = CSVFormat.DEFAULT;<a name="line.67"></a>
-<FONT color="green">068</FONT>            <a name="line.68"></a>
-<FONT color="green">069</FONT>            assertEquals("", format.format());<a name="line.69"></a>
-<FONT color="green">070</FONT>            assertEquals("a,b,c", format.format("a", "b", "c"));<a name="line.70"></a>
-<FONT color="green">071</FONT>            assertEquals("\"x,y\",z", format.format("x,y", "z"));<a name="line.71"></a>
-<FONT color="green">072</FONT>        }<a name="line.72"></a>
-<FONT color="green">073</FONT>        <a name="line.73"></a>
-<FONT color="green">074</FONT>        public void testValidation() {<a name="line.74"></a>
-<FONT color="green">075</FONT>            CSVFormat format = CSVFormat.DEFAULT;<a name="line.75"></a>
-<FONT color="green">076</FONT>            <a name="line.76"></a>
-<FONT color="green">077</FONT>            try {<a name="line.77"></a>
-<FONT color="green">078</FONT>                format.withDelimiter('\n');<a name="line.78"></a>
-<FONT color="green">079</FONT>                fail();<a name="line.79"></a>
-<FONT color="green">080</FONT>            } catch (IllegalArgumentException e) {<a name="line.80"></a>
-<FONT color="green">081</FONT>                // expected<a name="line.81"></a>
-<FONT color="green">082</FONT>            }<a name="line.82"></a>
-<FONT color="green">083</FONT>            <a name="line.83"></a>
-<FONT color="green">084</FONT>            try {<a name="line.84"></a>
-<FONT color="green">085</FONT>                format.withEscape('\r');<a name="line.85"></a>
-<FONT color="green">086</FONT>                fail();<a name="line.86"></a>
-<FONT color="green">087</FONT>            } catch (IllegalArgumentException e) {<a name="line.87"></a>
-<FONT color="green">088</FONT>                // expected<a name="line.88"></a>
-<FONT color="green">089</FONT>            }<a name="line.89"></a>
-<FONT color="green">090</FONT>            <a name="line.90"></a>
-<FONT color="green">091</FONT>            try {<a name="line.91"></a>
-<FONT color="green">092</FONT>                format.withEncapsulator('\n');<a name="line.92"></a>
-<FONT color="green">093</FONT>                fail();<a name="line.93"></a>
-<FONT color="green">094</FONT>            } catch (IllegalArgumentException e) {<a name="line.94"></a>
-<FONT color="green">095</FONT>                // expected<a name="line.95"></a>
-<FONT color="green">096</FONT>            }<a name="line.96"></a>
-<FONT color="green">097</FONT>            <a name="line.97"></a>
-<FONT color="green">098</FONT>            try {<a name="line.98"></a>
-<FONT color="green">099</FONT>                format.withCommentStart('\r');<a name="line.99"></a>
-<FONT color="green">100</FONT>                fail();<a name="line.100"></a>
-<FONT color="green">101</FONT>            } catch (IllegalArgumentException e) {<a name="line.101"></a>
-<FONT color="green">102</FONT>                // expected<a name="line.102"></a>
-<FONT color="green">103</FONT>            }<a name="line.103"></a>
-<FONT color="green">104</FONT>            <a name="line.104"></a>
-<FONT color="green">105</FONT>            try {<a name="line.105"></a>
-<FONT color="green">106</FONT>                format.withDelimiter('!').withEscape('!').validate();<a name="line.106"></a>
-<FONT color="green">107</FONT>                fail();<a name="line.107"></a>
-<FONT color="green">108</FONT>            } catch (IllegalArgumentException e) {<a name="line.108"></a>
-<FONT color="green">109</FONT>                // expected<a name="line.109"></a>
-<FONT color="green">110</FONT>            }<a name="line.110"></a>
-<FONT color="green">111</FONT>            <a name="line.111"></a>
-<FONT color="green">112</FONT>            try {<a name="line.112"></a>
-<FONT color="green">113</FONT>                format.withDelimiter('!').withCommentStart('!').validate();<a name="line.113"></a>
-<FONT color="green">114</FONT>                fail();<a name="line.114"></a>
-<FONT color="green">115</FONT>            } catch (IllegalArgumentException e) {<a name="line.115"></a>
-<FONT color="green">116</FONT>                // expected<a name="line.116"></a>
-<FONT color="green">117</FONT>            }<a name="line.117"></a>
-<FONT color="green">118</FONT>            <a name="line.118"></a>
-<FONT color="green">119</FONT>            try {<a name="line.119"></a>
-<FONT color="green">120</FONT>                format.withEncapsulator('!').withCommentStart('!').validate();<a name="line.120"></a>
-<FONT color="green">121</FONT>                fail();<a name="line.121"></a>
-<FONT color="green">122</FONT>            } catch (IllegalArgumentException e) {<a name="line.122"></a>
-<FONT color="green">123</FONT>                // expected<a name="line.123"></a>
-<FONT color="green">124</FONT>            }<a name="line.124"></a>
-<FONT color="green">125</FONT>            <a name="line.125"></a>
-<FONT color="green">126</FONT>            format.withEncapsulator(CSVFormat.DISABLED).withCommentStart(CSVFormat.DISABLED).validate();<a name="line.126"></a>
-<FONT color="green">127</FONT>            <a name="line.127"></a>
-<FONT color="green">128</FONT>            try {<a name="line.128"></a>
-<FONT color="green">129</FONT>                format.withEscape('!').withCommentStart('!').validate();<a name="line.129"></a>
-<FONT color="green">130</FONT>                fail();<a name="line.130"></a>
-<FONT color="green">131</FONT>            } catch (IllegalArgumentException e) {<a name="line.131"></a>
-<FONT color="green">132</FONT>                // expected<a name="line.132"></a>
-<FONT color="green">133</FONT>            }<a name="line.133"></a>
-<FONT color="green">134</FONT>            <a name="line.134"></a>
-<FONT color="green">135</FONT>            format.withEscape(CSVFormat.DISABLED).withCommentStart(CSVFormat.DISABLED).validate();<a name="line.135"></a>
-<FONT color="green">136</FONT>            <a name="line.136"></a>
-<FONT color="green">137</FONT>            <a name="line.137"></a>
-<FONT color="green">138</FONT>            try {<a name="line.138"></a>
-<FONT color="green">139</FONT>                format.withEncapsulator('!').withDelimiter('!').validate();<a name="line.139"></a>
-<FONT color="green">140</FONT>                fail();<a name="line.140"></a>
-<FONT color="green">141</FONT>            } catch (IllegalArgumentException e) {<a name="line.141"></a>
-<FONT color="green">142</FONT>                // expected<a name="line.142"></a>
-<FONT color="green">143</FONT>            }<a name="line.143"></a>
-<FONT color="green">144</FONT>            <a name="line.144"></a>
-<FONT color="green">145</FONT>            <a name="line.145"></a>
-<FONT color="green">146</FONT>        }<a name="line.146"></a>
-<FONT color="green">147</FONT>    } <a name="line.147"></a>
+<FONT color="green">024</FONT>    import java.io.ByteArrayInputStream;<a name="line.24"></a>
+<FONT color="green">025</FONT>    import java.io.ByteArrayOutputStream;<a name="line.25"></a>
+<FONT color="green">026</FONT>    import java.io.ObjectInputStream;<a name="line.26"></a>
+<FONT color="green">027</FONT>    import java.io.ObjectOutputStream;<a name="line.27"></a>
+<FONT color="green">028</FONT>    <a name="line.28"></a>
+<FONT color="green">029</FONT>    import org.junit.Test;<a name="line.29"></a>
+<FONT color="green">030</FONT>    <a name="line.30"></a>
+<FONT color="green">031</FONT>    /**<a name="line.31"></a>
+<FONT color="green">032</FONT>     * <a name="line.32"></a>
+<FONT color="green">033</FONT>     * <a name="line.33"></a>
+<FONT color="green">034</FONT>     * @version $Id: CSVFormatTest.java 1429926 2013-01-07 18:00:46Z ggregory $<a name="line.34"></a>
+<FONT color="green">035</FONT>     */<a name="line.35"></a>
+<FONT color="green">036</FONT>    public class CSVFormatTest {<a name="line.36"></a>
+<FONT color="green">037</FONT>    <a name="line.37"></a>
+<FONT color="green">038</FONT>        @Test<a name="line.38"></a>
+<FONT color="green">039</FONT>        public void testFormat() {<a name="line.39"></a>
+<FONT color="green">040</FONT>            final CSVFormat format = CSVFormat.DEFAULT;<a name="line.40"></a>
+<FONT color="green">041</FONT>    <a name="line.41"></a>
+<FONT color="green">042</FONT>            assertEquals("", format.format());<a name="line.42"></a>
+<FONT color="green">043</FONT>            assertEquals("a,b,c", format.format("a", "b", "c"));<a name="line.43"></a>
+<FONT color="green">044</FONT>            assertEquals("\"x,y\",z", format.format("x,y", "z"));<a name="line.44"></a>
+<FONT color="green">045</FONT>        }<a name="line.45"></a>
+<FONT color="green">046</FONT>    <a name="line.46"></a>
+<FONT color="green">047</FONT>        @SuppressWarnings("boxing") // no need to worry about boxing here<a name="line.47"></a>
+<FONT color="green">048</FONT>        @Test<a name="line.48"></a>
+<FONT color="green">049</FONT>        public void testSerialization() throws Exception {<a name="line.49"></a>
+<FONT color="green">050</FONT>            final ByteArrayOutputStream out = new ByteArrayOutputStream();<a name="line.50"></a>
+<FONT color="green">051</FONT>    <a name="line.51"></a>
+<FONT color="green">052</FONT>            final ObjectOutputStream oos = new ObjectOutputStream(out);<a name="line.52"></a>
+<FONT color="green">053</FONT>            oos.writeObject(CSVFormat.DEFAULT);<a name="line.53"></a>
+<FONT color="green">054</FONT>            oos.flush();<a name="line.54"></a>
+<FONT color="green">055</FONT>            oos.close();<a name="line.55"></a>
+<FONT color="green">056</FONT>    <a name="line.56"></a>
+<FONT color="green">057</FONT>            final ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(out.toByteArray()));<a name="line.57"></a>
+<FONT color="green">058</FONT>            final CSVFormat format = (CSVFormat) in.readObject();<a name="line.58"></a>
+<FONT color="green">059</FONT>    <a name="line.59"></a>
+<FONT color="green">060</FONT>            assertNotNull(format);<a name="line.60"></a>
+<FONT color="green">061</FONT>            assertEquals("delimiter", CSVFormat.DEFAULT.getDelimiter(), format.getDelimiter());<a name="line.61"></a>
+<FONT color="green">062</FONT>            assertEquals("encapsulator", CSVFormat.DEFAULT.getQuoteChar(), format.getQuoteChar());<a name="line.62"></a>
+<FONT color="green">063</FONT>            assertEquals("comment start", CSVFormat.DEFAULT.getCommentStart(), format.getCommentStart());<a name="line.63"></a>
+<FONT color="green">064</FONT>            assertEquals("line separator", CSVFormat.DEFAULT.getRecordSeparator(), format.getRecordSeparator());<a name="line.64"></a>
+<FONT color="green">065</FONT>            assertEquals("escape", CSVFormat.DEFAULT.getEscape(), format.getEscape());<a name="line.65"></a>
+<FONT color="green">066</FONT>            assertEquals("trim", CSVFormat.DEFAULT.getIgnoreSurroundingSpaces(), format.getIgnoreSurroundingSpaces());<a name="line.66"></a>
+<FONT color="green">067</FONT>            assertEquals("empty lines", CSVFormat.DEFAULT.getIgnoreEmptyLines(), format.getIgnoreEmptyLines());<a name="line.67"></a>
+<FONT color="green">068</FONT>        }<a name="line.68"></a>
+<FONT color="green">069</FONT>        <a name="line.69"></a>
+<FONT color="green">070</FONT>        @Test<a name="line.70"></a>
+<FONT color="green">071</FONT>        public void testEquals() {<a name="line.71"></a>
+<FONT color="green">072</FONT>            final CSVFormat right = CSVFormat.DEFAULT;<a name="line.72"></a>
+<FONT color="green">073</FONT>            final CSVFormat left = CSVFormat.newBuilder().build();<a name="line.73"></a>
+<FONT color="green">074</FONT>    <a name="line.74"></a>
+<FONT color="green">075</FONT>            assertFalse(right.equals(null));<a name="line.75"></a>
+<FONT color="green">076</FONT>            assertFalse(right.equals("A String Instance"));<a name="line.76"></a>
+<FONT color="green">077</FONT>    <a name="line.77"></a>
+<FONT color="green">078</FONT>            assertEquals(right, right);<a name="line.78"></a>
+<FONT color="green">079</FONT>            assertEquals(right, left);<a name="line.79"></a>
+<FONT color="green">080</FONT>            assertEquals(left, right);<a name="line.80"></a>
+<FONT color="green">081</FONT>            <a name="line.81"></a>
+<FONT color="green">082</FONT>            assertEquals(right.hashCode(), right.hashCode());<a name="line.82"></a>
+<FONT color="green">083</FONT>            assertEquals(right.hashCode(), left.hashCode());<a name="line.83"></a>
+<FONT color="green">084</FONT>        }<a name="line.84"></a>
+<FONT color="green">085</FONT>    <a name="line.85"></a>
+<FONT color="green">086</FONT>        @Test<a name="line.86"></a>
+<FONT color="green">087</FONT>        public void testEqualsDelimiter() {<a name="line.87"></a>
+<FONT color="green">088</FONT>            final CSVFormat right = CSVFormat.newBuilder('!').build();<a name="line.88"></a>
+<FONT color="green">089</FONT>            final CSVFormat left = CSVFormat.newBuilder('?').build();<a name="line.89"></a>
+<FONT color="green">090</FONT>    <a name="line.90"></a>
+<FONT color="green">091</FONT>            assertNotEquals(right, left);<a name="line.91"></a>
+<FONT color="green">092</FONT>        }<a name="line.92"></a>
+<FONT color="green">093</FONT>    <a name="line.93"></a>
+<FONT color="green">094</FONT>        @Test<a name="line.94"></a>
+<FONT color="green">095</FONT>        public void testEqualsQuoteChar() {<a name="line.95"></a>
+<FONT color="green">096</FONT>            final CSVFormat right = CSVFormat.newBuilder('\'').withQuoteChar('"').build();<a name="line.96"></a>
+<FONT color="green">097</FONT>            final CSVFormat left = CSVFormat.newBuilder(right).withQuoteChar('!').build();<a name="line.97"></a>
+<FONT color="green">098</FONT>    <a name="line.98"></a>
+<FONT color="green">099</FONT>            assertNotEquals(right, left);<a name="line.99"></a>
+<FONT color="green">100</FONT>        }<a name="line.100"></a>
+<FONT color="green">101</FONT>    <a name="line.101"></a>
+<FONT color="green">102</FONT>        @Test<a name="line.102"></a>
+<FONT color="green">103</FONT>        public void testEqualsQuotePolicy() {<a name="line.103"></a>
+<FONT color="green">104</FONT>            final CSVFormat right = CSVFormat.newBuilder('\'')<a name="line.104"></a>
+<FONT color="green">105</FONT>                    .withQuoteChar('"')<a name="line.105"></a>
+<FONT color="green">106</FONT>                    .withQuotePolicy(Quote.ALL)<a name="line.106"></a>
+<FONT color="green">107</FONT>                    .build();<a name="line.107"></a>
+<FONT color="green">108</FONT>            final CSVFormat left = CSVFormat.newBuilder(right)<a name="line.108"></a>
+<FONT color="green">109</FONT>                    .withQuotePolicy(Quote.MINIMAL)<a name="line.109"></a>
+<FONT color="green">110</FONT>                    .build();<a name="line.110"></a>
+<FONT color="green">111</FONT>    <a name="line.111"></a>
+<FONT color="green">112</FONT>            assertNotEquals(right, left);<a name="line.112"></a>
+<FONT color="green">113</FONT>        }<a name="line.113"></a>
+<FONT color="green">114</FONT>    <a name="line.114"></a>
+<FONT color="green">115</FONT>        @Test<a name="line.115"></a>
+<FONT color="green">116</FONT>        public void testEqualsCommentStart() {<a name="line.116"></a>
+<FONT color="green">117</FONT>            final CSVFormat right = CSVFormat.newBuilder('\'')<a name="line.117"></a>
+<FONT color="green">118</FONT>                    .withQuoteChar('"')<a name="line.118"></a>
+<FONT color="green">119</FONT>                    .withQuotePolicy(Quote.ALL)<a name="line.119"></a>
+<FONT color="green">120</FONT>                    .withCommentStart('#')<a name="line.120"></a>
+<FONT color="green">121</FONT>                    .build();<a name="line.121"></a>
+<FONT color="green">122</FONT>            final CSVFormat left = CSVFormat.newBuilder(right)<a name="line.122"></a>
+<FONT color="green">123</FONT>                    .withCommentStart('!')<a name="line.123"></a>
+<FONT color="green">124</FONT>                    .build();<a name="line.124"></a>
+<FONT color="green">125</FONT>    <a name="line.125"></a>
+<FONT color="green">126</FONT>            assertNotEquals(right, left);<a name="line.126"></a>
+<FONT color="green">127</FONT>        }<a name="line.127"></a>
+<FONT color="green">128</FONT>    <a name="line.128"></a>
+<FONT color="green">129</FONT>        @Test<a name="line.129"></a>
+<FONT color="green">130</FONT>        public void testEqualsEscape() {<a name="line.130"></a>
+<FONT color="green">131</FONT>            final CSVFormat right = CSVFormat.newBuilder('\'')<a name="line.131"></a>
+<FONT color="green">132</FONT>                    .withQuoteChar('"')<a name="line.132"></a>
+<FONT color="green">133</FONT>                    .withQuotePolicy(Quote.ALL)<a name="line.133"></a>
+<FONT color="green">134</FONT>                    .withCommentStart('#')<a name="line.134"></a>
+<FONT color="green">135</FONT>                    .withEscape('+')<a name="line.135"></a>
+<FONT color="green">136</FONT>                    .build();<a name="line.136"></a>
+<FONT color="green">137</FONT>            final CSVFormat left = CSVFormat.newBuilder(right)<a name="line.137"></a>
+<FONT color="green">138</FONT>                    .withEscape('!')<a name="line.138"></a>
+<FONT color="green">139</FONT>                    .build();<a name="line.139"></a>
+<FONT color="green">140</FONT>    <a name="line.140"></a>
+<FONT color="green">141</FONT>            assertNotEquals(right, left);<a name="line.141"></a>
+<FONT color="green">142</FONT>        }<a name="line.142"></a>
+<FONT color="green">143</FONT>    <a name="line.143"></a>
+<FONT color="green">144</FONT>        @Test<a name="line.144"></a>
+<FONT color="green">145</FONT>        public void testEqualsIgnoreSurroundingSpaces() {<a name="line.145"></a>
+<FONT color="green">146</FONT>            final CSVFormat right = CSVFormat.newBuilder('\'')<a name="line.146"></a>
+<FONT color="green">147</FONT>                    .withQuoteChar('"')<a name="line.147"></a>
+<FONT color="green">148</FONT>                    .withQuotePolicy(Quote.ALL)<a name="line.148"></a>
+<FONT color="green">149</FONT>                    .withCommentStart('#')<a name="line.149"></a>
+<FONT color="green">150</FONT>                    .withEscape('+')<a name="line.150"></a>
+<FONT color="green">151</FONT>                    .withIgnoreSurroundingSpaces(true)<a name="line.151"></a>
+<FONT color="green">152</FONT>                    .build();<a name="line.152"></a>
+<FONT color="green">153</FONT>            final CSVFormat left = CSVFormat.newBuilder(right)<a name="line.153"></a>
+<FONT color="green">154</FONT>                    .withIgnoreSurroundingSpaces(false)<a name="line.154"></a>
+<FONT color="green">155</FONT>                    .build();<a name="line.155"></a>
+<FONT color="green">156</FONT>    <a name="line.156"></a>
+<FONT color="green">157</FONT>            assertNotEquals(right, left);<a name="line.157"></a>
+<FONT color="green">158</FONT>        }<a name="line.158"></a>
+<FONT color="green">159</FONT>    <a name="line.159"></a>
+<FONT color="green">160</FONT>        @Test<a name="line.160"></a>
+<FONT color="green">161</FONT>        public void testEqualsIgnoreEmptyLines() {<a name="line.161"></a>
+<FONT color="green">162</FONT>            final CSVFormat right = CSVFormat.newBuilder('\'')<a name="line.162"></a>
+<FONT color="green">163</FONT>                    .withQuoteChar('"')<a name="line.163"></a>
+<FONT color="green">164</FONT>                    .withQuotePolicy(Quote.ALL)<a name="line.164"></a>
+<FONT color="green">165</FONT>                    .withCommentStart('#')<a name="line.165"></a>
+<FONT color="green">166</FONT>                    .withEscape('+')<a name="line.166"></a>
+<FONT color="green">167</FONT>                    .withIgnoreSurroundingSpaces(true)<a name="line.167"></a>
+<FONT color="green">168</FONT>                    .withIgnoreEmptyLines(true)<a name="line.168"></a>
+<FONT color="green">169</FONT>                    .build();<a name="line.169"></a>
+<FONT color="green">170</FONT>            final CSVFormat left = CSVFormat.newBuilder(right)<a name="line.170"></a>
+<FONT color="green">171</FONT>                    .withIgnoreEmptyLines(false)<a name="line.171"></a>
+<FONT color="green">172</FONT>                    .build();<a name="line.172"></a>
+<FONT color="green">173</FONT>    <a name="line.173"></a>
+<FONT color="green">174</FONT>            assertNotEquals(right, left);<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 testEqualsRecordSeparator() {<a name="line.178"></a>
+<FONT color="green">179</FONT>            final CSVFormat right = CSVFormat.newBuilder('\'')<a name="line.179"></a>
+<FONT color="green">180</FONT>                    .withQuoteChar('"')<a name="line.180"></a>
+<FONT color="green">181</FONT>                    .withQuotePolicy(Quote.ALL)<a name="line.181"></a>
+<FONT color="green">182</FONT>                    .withCommentStart('#')<a name="line.182"></a>
+<FONT color="green">183</FONT>                    .withEscape('+')<a name="line.183"></a>
+<FONT color="green">184</FONT>                    .withIgnoreSurroundingSpaces(true)<a name="line.184"></a>
+<FONT color="green">185</FONT>                    .withIgnoreEmptyLines(true)<a name="line.185"></a>
+<FONT color="green">186</FONT>                    .withRecordSeparator('*')<a name="line.186"></a>
+<FONT color="green">187</FONT>                    .build();<a name="line.187"></a>
+<FONT color="green">188</FONT>            final CSVFormat left = CSVFormat.newBuilder(right)<a name="line.188"></a>
+<FONT color="green">189</FONT>                    .withRecordSeparator('!')<a name="line.189"></a>
+<FONT color="green">190</FONT>                    .build();<a name="line.190"></a>
+<FONT color="green">191</FONT>    <a name="line.191"></a>
+<FONT color="green">192</FONT>            assertNotEquals(right, left);<a name="line.192"></a>
+<FONT color="green">193</FONT>        }<a name="line.193"></a>
+<FONT color="green">194</FONT>    <a name="line.194"></a>
+<FONT color="green">195</FONT>        @Test<a name="line.195"></a>
+<FONT color="green">196</FONT>        public void testEqualsHeader() {<a name="line.196"></a>
+<FONT color="green">197</FONT>            final CSVFormat right = CSVFormat.newBuilder('\'')<a name="line.197"></a>
+<FONT color="green">198</FONT>                    .withQuoteChar('"')<a name="line.198"></a>
+<FONT color="green">199</FONT>                    .withQuotePolicy(Quote.ALL)<a name="line.199"></a>
+<FONT color="green">200</FONT>                    .withCommentStart('#')<a name="line.200"></a>
+<FONT color="green">201</FONT>                    .withEscape('+')<a name="line.201"></a>
+<FONT color="green">202</FONT>                    .withIgnoreSurroundingSpaces(true)<a name="line.202"></a>
+<FONT color="green">203</FONT>                    .withIgnoreEmptyLines(true)<a name="line.203"></a>
+<FONT color="green">204</FONT>                    .withRecordSeparator('*')<a name="line.204"></a>
+<FONT color="green">205</FONT>                    .withHeader("One", "Two", "Three")<a name="line.205"></a>
+<FONT color="green">206</FONT>                    .build();<a name="line.206"></a>
+<FONT color="green">207</FONT>            final CSVFormat left = CSVFormat.newBuilder(right)<a name="line.207"></a>
+<FONT color="green">208</FONT>                    .withHeader("Three", "Two", "One")<a name="line.208"></a>
+<FONT color="green">209</FONT>                    .build();<a name="line.209"></a>
+<FONT color="green">210</FONT>            <a name="line.210"></a>
+<FONT color="green">211</FONT>            assertNotEquals(right, left);<a name="line.211"></a>
+<FONT color="green">212</FONT>        }<a name="line.212"></a>
+<FONT color="green">213</FONT>    <a name="line.213"></a>
+<FONT color="green">214</FONT>        private static void assertNotEquals(final Object right, final Object left) {<a name="line.214"></a>
+<FONT color="green">215</FONT>            assertFalse(right.equals(left));<a name="line.215"></a>
+<FONT color="green">216</FONT>            assertFalse(left.equals(right));<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>
 
 
 
@@ -210,4 +281,4 @@
 
 </PRE>
 </BODY>
-</HTML>
+</HTML>
\ No newline at end of file



Mime
View raw message