commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1509069 - in /commons/proper/csv/trunk/src: main/java/org/apache/commons/csv/ test/java/org/apache/commons/csv/
Date Thu, 01 Aug 2013 02:04:27 GMT
Author: ggregory
Date: Thu Aug  1 02:04:27 2013
New Revision: 1509069

URL: http://svn.apache.org/r1509069
Log:
- Remove trailing spaces.
- Add missing final keywords.

Modified:
    commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java
    commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVLexer.java
    commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java
    commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Constants.java
    commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java
    commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java
    commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Token.java
    commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFileParserTest.java
    commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java
    commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java
    commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java
    commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
    commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVRecordTest.java
    commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/TokenMatchers.java

Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java?rev=1509069&r1=1509068&r2=1509069&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java (original)
+++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java Thu Aug 
1 02:04:27 2013
@@ -53,7 +53,7 @@ import java.util.Set;
 public class CSVFormat implements Serializable {
 
     private static final long serialVersionUID = 1L;
-    
+
     /**
      * Returns true if the given character is a line break character.
      *
@@ -66,7 +66,7 @@ public class CSVFormat implements Serial
     static boolean isLineBreak(final Character c) {
         return c != null && isLineBreak(c.charValue());
     }
-    
+
     private final char delimiter;
     private final Character quoteChar;
     private final Quote quotePolicy;
@@ -324,8 +324,8 @@ public class CSVFormat implements Serial
     }
 
     /**
-     * Returns a copy of the header array. 
-     * 
+     * Returns a copy of the header array.
+     *
      * @return a copy of the header array
      */
     public String[] getHeader() {
@@ -362,7 +362,7 @@ public class CSVFormat implements Serial
      * <li>
      * <strong>Writing:</strong> Writes {@code null} as the given {@code nullString}
when writing records.</li>
      * </ul>
-     * 
+     *
      * @return the String to convert to and from {@code null}. No substitution occurs if
{@code null}
      */
     public String getNullString() {
@@ -454,11 +454,11 @@ public class CSVFormat implements Serial
 
 	/**
 	 * Parses the specified content.
-	 * 
+	 *
 	 * <p>
 	 * See also the various static parse methods on {@link CSVParser}.
 	 * </p>
-	 * 
+	 *
 	 * @param in
 	 *            the input stream
 	 * @return a parser over a stream of {@link #CSVRecord}s.
@@ -528,9 +528,9 @@ public class CSVFormat implements Serial
         if (escape == null && quotePolicy == Quote.NONE) {
             throw new IllegalStateException("No quotes mode set but no escape character is
set");
         }
-        
+
         if (header != null) {
-            Set<String> set = new HashSet<String>(header.length);
+            final Set<String> set = new HashSet<String>(header.length);
             set.addAll(Arrays.asList(header));
             if (set.size() != header.length) {
                 throw new IllegalStateException("The header contains duplicate names: " +
Arrays.toString(header));
@@ -621,18 +621,18 @@ public class CSVFormat implements Serial
 
     /**
      * Sets the header of the format. The header can either be parsed automatically from
the input file with:
-     * 
+     *
      * <pre>
      * CSVFormat format = aformat.withHeader();</pre>
-     * 
+     *
      * or specified manually with:
-     * 
+     *
      * <pre>
      * CSVFormat format = aformat.withHeader(&quot;name&quot;, &quot;email&quot;,
&quot;phone&quot;);</pre>
-     * 
+     *
      * @param header
      *            the header, <tt>null</tt> if disabled, empty if parsed automatically,
user specified otherwise.
-     * 
+     *
      * @return A new CSVFormat that is equal to this but with the specified header
      * @see #withSkipHeaderRecord(boolean)
      */

Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVLexer.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVLexer.java?rev=1509069&r1=1509068&r2=1509069&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVLexer.java (original)
+++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVLexer.java Thu Aug  1
02:04:27 2013
@@ -86,11 +86,11 @@ final class CSVLexer extends Lexer {
         }
 
         if (isStartOfLine(lastChar) && isCommentStart(c)) {
-            String line = in.readLine();
+            final String line = in.readLine();
             if (line == null) {
                 token.type = EOF;
                 // don't set token.isReady here because no content
-                return token;                
+                return token;
             }
             final String comment = line.trim();
             token.content.append(comment);

Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java?rev=1509069&r1=1509068&r2=1509069&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java (original)
+++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java Thu Aug 
1 02:04:27 2013
@@ -37,15 +37,15 @@ import java.util.NoSuchElementException;
 
 /**
  * Parses CSV files according to the specified configuration.
- * 
+ *
  * Because CSV appears in many different dialects, the parser supports many configuration
settings by allowing the
  * specification of a {@link CSVFormat}.
- * 
+ *
  * <p>
  * To parse a CSV input with tabs as separators, '"' (double-quote) as an optional value
encapsulator, and comments
  * starting with '#', you write:
  * </p>
- * 
+ *
  * <pre>
  * Reader in = new StringReader(&quot;a\tb\nc\td&quot;);
  * Iterable&lt;CSVRecord&gt; parser = CSVFormat.DEFAULT
@@ -56,11 +56,11 @@ import java.util.NoSuchElementException;
  *     ...
  *  }
  * </pre>
- * 
+ *
  * <p>
  * To parse CSV input in a given format like Excel, you write:
  * </p>
- * 
+ *
  * <pre>
  * Reader in = new StringReader("a;b\nc;d");
  * Iterable&lt;CSVRecord&gt; parser = CSVFormat.EXCEL.parse(in);
@@ -71,7 +71,7 @@ import java.util.NoSuchElementException;
  * <p>
  * You may also get a List of records:
  * </p>
- * 
+ *
  * <pre>
  * Reader in = new StringReader(&quot;a;b\nc;d&quot;);
  * CSVParser parser = new CSVParser(in, CSVFormat.EXCEL);
@@ -83,18 +83,18 @@ import java.util.NoSuchElementException;
  * <p>
  * Internal parser state is completely covered by the format and the reader-state.
  * </p>
- * 
+ *
  * <p>
  * see <a href="package-summary.html">package documentation</a> for more details
  * </p>
- * 
+ *
  * @version $Id$
  */
 public class CSVParser implements Iterable<CSVRecord>, Closeable {
 
     /**
      * Creates a parser for the given {@link File}.
-     * 
+     *
      * @param file
      *            a CSV file
      * @param format
@@ -109,11 +109,11 @@ public class CSVParser implements Iterab
 
     /**
      * Creates a parser for the given resource.
-     * 
+     *
      * <p>
      * If you do not read all records from the given source, you should call {@link #close()}
on the parser.
      * </p>
-     * 
+     *
      * @param resource
      *            a resource path
      * @param charset
@@ -128,7 +128,7 @@ public class CSVParser implements Iterab
      */
     public static CSVParser parseResource(String resource, Charset charset, ClassLoader classLoader,
             final CSVFormat format) throws IOException {
-        URL url = classLoader.getResource(resource);
+        final URL url = classLoader.getResource(resource);
         if (url == null) {
             throw new IllegalArgumentException("Resource cannot be found: " + resource);
         }
@@ -137,11 +137,11 @@ public class CSVParser implements Iterab
 
     /**
      * Creates a parser for the given resource.
-     * 
+     *
      * <p>
      * If you do not read all records from the given source, you should call {@link #close()}
on the parser.
      * </p>
-     * 
+     *
      * @param resource
      *            a resource path
      * @param charset
@@ -153,7 +153,7 @@ public class CSVParser implements Iterab
      *             If an I/O error occurs
      */
     public static CSVParser parseResource(String resource, Charset charset, final CSVFormat
format) throws IOException {
-        URL url = ClassLoader.getSystemResource(resource);
+        final URL url = ClassLoader.getSystemResource(resource);
         if (url == null) {
             throw new IllegalArgumentException("System resource cannot be found: " + resource);
         }
@@ -162,7 +162,7 @@ public class CSVParser implements Iterab
 
     /**
      * Creates a parser for the given {@link String} using the default format {@link CSVFormat#DEFAULT}.
-     * 
+     *
      * @param string
      *            a CSV string
      * @return a new parser
@@ -175,7 +175,7 @@ public class CSVParser implements Iterab
 
     /**
      * Creates a parser for the given {@link String}.
-     * 
+     *
      * @param string
      *            a CSV string
      * @param format
@@ -190,12 +190,12 @@ public class CSVParser implements Iterab
 
     /**
      * Creates a parser for the given URL.
-     * 
+     *
      * <p>
      * If you do not read all records from the given {@code url}, you should call {@link
#close()} on the parser, unless
      * you close the {@code url}.
      * </p>
-     * 
+     *
      * @param url
      *            a URL
      * @param charset
@@ -230,12 +230,12 @@ public class CSVParser implements Iterab
 
     /**
      * CSV parser using the default format {@link CSVFormat#DEFAULT}.
-     * 
+     *
      * <p>
      * If you do not read all records from the given {@code reader}, you should call {@link
#close()} on the parser,
      * unless you close the {@code reader}.
      * </p>
-     * 
+     *
      * @param input
      *            a Reader containing "csv-formatted" input
      * @throws IllegalArgumentException
@@ -249,12 +249,12 @@ public class CSVParser implements Iterab
 
     /**
      * Customized CSV parser using the given {@link CSVFormat}
-     * 
+     *
      * <p>
      * If you do not read all records from the given {@code reader}, you should call {@link
#close()} on the parser,
      * unless you close the {@code reader}.
      * </p>
-     * 
+     *
      * @param reader
      *            a Reader containing CSV-formatted input
      * @param format
@@ -283,7 +283,7 @@ public class CSVParser implements Iterab
 
     /**
      * Closes resources.
-     * 
+     *
      * @throws IOException
      *             If an I/O error occurs
      */
@@ -297,7 +297,7 @@ public class CSVParser implements Iterab
      * Returns the current line number in the input stream.
      * <p/>
      * ATTENTION: If your CSV input has multi-line values, the returned number does not correspond
to the record number.
-     * 
+     *
      * @return current line number
      */
     public long getCurrentLineNumber() {
@@ -308,7 +308,7 @@ public class CSVParser implements Iterab
      * Returns a copy of the header map that iterates in column order.
      * <p>
      * The map keys are column names. The map values are 0-based indices.
-     * 
+     *
      * @return a copy of the header map that iterates in column order.
      */
     public Map<String, Integer> getHeaderMap() {
@@ -319,7 +319,7 @@ public class CSVParser implements Iterab
      * Returns the current record number in the input stream.
      * <p/>
      * ATTENTION: If your CSV input has multi-line values, the returned number does not correspond
to the line number.
-     * 
+     *
      * @return current line number
      */
     public long getRecordNumber() {
@@ -331,7 +331,7 @@ public class CSVParser implements Iterab
      * entries.
      * <p/>
      * The returned content starts at the current parse-position in the stream.
-     * 
+     *
      * @return list of {@link CSVRecord} entries, may be empty
      * @throws IOException
      *             on parse error or input read-failure
@@ -350,7 +350,7 @@ public class CSVParser implements Iterab
      */
     private Map<String, Integer> initializeHeader() throws IOException {
         Map<String, Integer> hdrMap = null;
-        String[] formatHeader = this.format.getHeader();
+        final String[] formatHeader = this.format.getHeader();
         if (formatHeader != null) {
             hdrMap = new LinkedHashMap<String, Integer>();
 
@@ -436,7 +436,7 @@ public class CSVParser implements Iterab
 
     /**
      * Parses the next record from the current point in the stream.
-     * 
+     *
      * @return the record as an array of values, or <tt>null</tt> if the end
of the stream has been reached
      * @throws IOException
      *             on parse error or input read-failure

Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Constants.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Constants.java?rev=1509069&r1=1509068&r2=1509069&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Constants.java (original)
+++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Constants.java Thu Aug 
1 02:04:27 2013
@@ -49,7 +49,7 @@ final class Constants {
 
     /** According to RFC 4180, line breaks are delimited by CRLF */
     static final String CRLF = "\r\n";
-    
+
     /**
      * Unicode line separator.
      */

Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java?rev=1509069&r1=1509068&r2=1509069&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java
(original)
+++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java
Thu Aug  1 02:04:27 2013
@@ -41,7 +41,7 @@ final class ExtendedBufferedReader exten
 
     /** The count of EOLs (CR/LF/CRLF) seen so far */
     private long eolCounter = 0;
-    
+
     private boolean closed;
 
     /**
@@ -163,7 +163,7 @@ final class ExtendedBufferedReader exten
 
 	/**
 	 * Closes the stream.
-	 * 
+	 *
 	 * @throws IOException
 	 *             If an I/O error occurs
 	 */

Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java?rev=1509069&r1=1509068&r2=1509069&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java (original)
+++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java Thu Aug  1 02:04:27
2013
@@ -151,7 +151,7 @@ abstract class Lexer implements Closeabl
     boolean isClosed() {
     	return in.isClosed();
     }
-    
+
     /**
      * @return true if the given char is a whitespace character
      */
@@ -201,7 +201,7 @@ abstract class Lexer implements Closeabl
 
     /**
      * Closes resources.
-     * 
+     *
 	 * @throws IOException
 	 *             If an I/O error occurs
      */

Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Token.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Token.java?rev=1509069&r1=1509068&r2=1509069&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Token.java (original)
+++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Token.java Thu Aug  1 02:04:27
2013
@@ -65,7 +65,7 @@ final class Token {
 
     /**
      * Eases IDE debugging.
-     * 
+     *
      * @return a string helpful for debugging.
      */
     @Override

Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFileParserTest.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFileParserTest.java?rev=1509069&r1=1509068&r2=1509069&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFileParserTest.java (original)
+++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFileParserTest.java Thu
Aug  1 02:04:27 2013
@@ -111,7 +111,7 @@ public class CSVFileParserTest {
 
         // Now parse the file and compare against the expected results
         // We use a buffered reader internally so no need to create one here.
-        CSVParser parser = CSVParser.parseFile(new File(BASE, split[0]), format);
+        final CSVParser parser = CSVParser.parseFile(new File(BASE, split[0]), format);
         for(final CSVRecord record : parser) {
             String parsed = record.toString();
             if (checkComments) {
@@ -153,7 +153,7 @@ public class CSVFileParserTest {
         assertEquals(testName + " Expected format ", line, format.toString());
 
         // Now parse the file and compare against the expected results
-        CSVParser parser = CSVParser.parseResource("CSVFileParser/" + split[0], Charset.forName("UTF-8"),
+        final CSVParser parser = CSVParser.parseResource("CSVFileParser/" + split[0], Charset.forName("UTF-8"),
                 this.getClass().getClassLoader(), format);
         for (final CSVRecord record : parser) {
             String parsed = record.toString();

Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java?rev=1509069&r1=1509068&r2=1509069&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java (original)
+++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java Thu Aug
 1 02:04:27 2013
@@ -214,10 +214,10 @@ public class CSVFormatTest {
 
     @Test
     public void testGetHeader() throws Exception {
-        String[] header = new String[]{"one", "two", "three"};
-        CSVFormat formatWithHeader = CSVFormat.DEFAULT.withHeader(header);
+        final String[] header = new String[]{"one", "two", "three"};
+        final CSVFormat formatWithHeader = CSVFormat.DEFAULT.withHeader(header);
         // getHeader() makes a copy of the header array.
-        String[] headerCopy = formatWithHeader.getHeader();
+        final String[] headerCopy = formatWithHeader.getHeader();
         headerCopy[0] = "A";
         headerCopy[1] = "B";
         headerCopy[2] = "C";
@@ -282,7 +282,7 @@ public class CSVFormatTest {
 
     @Test
     public void testWithCommentStart() throws Exception {
-        CSVFormat formatWithCommentStart = CSVFormat.DEFAULT.withCommentStart('#');
+        final CSVFormat formatWithCommentStart = CSVFormat.DEFAULT.withCommentStart('#');
         assertEquals( Character.valueOf('#'), formatWithCommentStart.getCommentStart());
     }
 
@@ -293,7 +293,7 @@ public class CSVFormatTest {
 
     @Test
     public void testWithDelimiter() throws Exception {
-        CSVFormat formatWithDelimiter = CSVFormat.DEFAULT.withDelimiter('!');
+        final CSVFormat formatWithDelimiter = CSVFormat.DEFAULT.withDelimiter('!');
         assertEquals('!', formatWithDelimiter.getDelimiter());
     }
 
@@ -304,7 +304,7 @@ public class CSVFormatTest {
 
     @Test
     public void testWithEscape() throws Exception {
-        CSVFormat formatWithEscape = CSVFormat.DEFAULT.withEscape('&');
+        final CSVFormat formatWithEscape = CSVFormat.DEFAULT.withEscape('&');
         assertEquals(Character.valueOf('&'), formatWithEscape.getEscape());
     }
 
@@ -315,9 +315,9 @@ public class CSVFormatTest {
 
     @Test
     public void testWithHeader() throws Exception {
-        String[] header = new String[]{"one", "two", "three"};
+        final String[] header = new String[]{"one", "two", "three"};
         // withHeader() makes a copy of the header array.
-        CSVFormat formatWithHeader = CSVFormat.DEFAULT.withHeader(header);
+        final CSVFormat formatWithHeader = CSVFormat.DEFAULT.withHeader(header);
         assertArrayEquals(header, formatWithHeader.getHeader());
         assertNotSame(header, formatWithHeader.getHeader());
         header[0] = "A";
@@ -340,13 +340,13 @@ public class CSVFormatTest {
 
     @Test
     public void testWithNullString() throws Exception {
-        CSVFormat formatWithNullString = CSVFormat.DEFAULT.withNullString("null");
+        final CSVFormat formatWithNullString = CSVFormat.DEFAULT.withNullString("null");
         assertEquals("null", formatWithNullString.getNullString());
     }
 
     @Test
     public void testWithQuoteChar() throws Exception {
-        CSVFormat formatWithQuoteChar = CSVFormat.DEFAULT.withQuoteChar('"');
+        final CSVFormat formatWithQuoteChar = CSVFormat.DEFAULT.withQuoteChar('"');
         assertEquals(Character.valueOf('"'), formatWithQuoteChar.getQuoteChar());
     }
 
@@ -357,13 +357,13 @@ public class CSVFormatTest {
 
     @Test
     public void testWithQuotePolicy() throws Exception {
-        CSVFormat formatWithQuotePolicy = CSVFormat.DEFAULT.withQuotePolicy(Quote.ALL);
+        final CSVFormat formatWithQuotePolicy = CSVFormat.DEFAULT.withQuotePolicy(Quote.ALL);
         assertEquals(Quote.ALL, formatWithQuotePolicy.getQuotePolicy());
     }
 
     @Test
     public void testWithRecordSeparator() throws Exception {
-        CSVFormat formatWithRecordSeparator = CSVFormat.DEFAULT.withRecordSeparator('!');
+        final CSVFormat formatWithRecordSeparator = CSVFormat.DEFAULT.withRecordSeparator('!');
         assertEquals("!", formatWithRecordSeparator.getRecordSeparator());
     }
 

Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java?rev=1509069&r1=1509068&r2=1509069&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java (original)
+++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java Thu Aug
 1 02:04:27 2013
@@ -26,11 +26,11 @@ import static org.apache.commons.csv.Tok
 import static org.apache.commons.csv.Token.Type.EOF;
 import static org.apache.commons.csv.Token.Type.EORECORD;
 import static org.apache.commons.csv.Token.Type.TOKEN;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertThat;
 import static org.apache.commons.csv.TokenMatchers.hasContent;
 import static org.apache.commons.csv.TokenMatchers.matches;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
 import java.io.StringReader;

Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java?rev=1509069&r1=1509068&r2=1509069&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java (original)
+++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java Thu Aug
 1 02:04:27 2013
@@ -472,7 +472,7 @@ public class CSVParserTest {
             iterator.remove();
             fail("expected UnsupportedOperationException");
         } catch (final UnsupportedOperationException expected) {
-            // expected 
+            // expected
         }
         assertArrayEquals(new String[]{"a", "b", "c"}, iterator.next().values());
         assertArrayEquals(new String[]{"1", "2", "3"}, iterator.next().values());

Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java?rev=1509069&r1=1509068&r2=1509069&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java (original)
+++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java Thu
Aug  1 02:04:27 2013
@@ -327,7 +327,7 @@ public class CSVPrinterTest {
         final CSVPrinter printer = new CSVPrinter(sw, format);
         printer.printRecord("a", null, "b");
         printer.close();
-        String csvString = sw.toString();
+        final String csvString = sw.toString();
         assertEquals("a,NULL,b" + recordSeparator, csvString);
         final Iterable<CSVRecord> iterable = format.parse(new StringReader(csvString));
         final Iterator<CSVRecord> iterator = iterable.iterator();
@@ -486,7 +486,7 @@ public class CSVPrinterTest {
 
     @Test(expected = IllegalArgumentException.class)
     public void testInvalidFormat() throws Exception {
-        CSVFormat invalidFormat = CSVFormat.DEFAULT.withDelimiter(CR);
+        final CSVFormat invalidFormat = CSVFormat.DEFAULT.withDelimiter(CR);
         new CSVPrinter(null, invalidFormat);
     }
 }

Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVRecordTest.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVRecordTest.java?rev=1509069&r1=1509068&r2=1509069&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVRecordTest.java (original)
+++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVRecordTest.java Thu Aug
 1 02:04:27 2013
@@ -22,7 +22,6 @@ import static org.junit.Assert.assertNul
 import static org.junit.Assert.assertTrue;
 
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 
 import org.junit.Before;
@@ -101,8 +100,7 @@ public class CSVRecordTest {
     @Test
     public void testIterator() {
         int i = 0;
-        for (final Iterator<String> itr = record.iterator(); itr.hasNext();) {
-            final String value = itr.next();
+        for (String value : record) {
             assertEquals(values[i], value);
             i++;
         }

Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/TokenMatchers.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/TokenMatchers.java?rev=1509069&r1=1509068&r2=1509069&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/TokenMatchers.java (original)
+++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/TokenMatchers.java Thu Aug
 1 02:04:27 2013
@@ -16,10 +16,11 @@
  */
 package org.apache.commons.csv;
 
+import static org.hamcrest.core.AllOf.allOf;
+
 import org.hamcrest.Description;
 import org.hamcrest.Matcher;
 import org.hamcrest.TypeSafeDiagnosingMatcher;
-import static org.hamcrest.core.AllOf.allOf;
 
 /**
  * Collection of matchers for asserting the type and content of tokens.



Mime
View raw message