You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/01/20 23:36:27 UTC

[commons-csv] 01/03: [CSV-248] CSVRecord is not Serializable.

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-csv.git

commit d047f83c283757e4848cd38332d822c378bb9774
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jan 20 18:34:31 2020 -0500

    [CSV-248] CSVRecord is not Serializable.
    
    Sort members.
---
 .../java/org/apache/commons/csv/CSVRecordTest.java | 34 +++++++++++-----------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/src/test/java/org/apache/commons/csv/CSVRecordTest.java b/src/test/java/org/apache/commons/csv/CSVRecordTest.java
index 06e771c..97bb6fc 100644
--- a/src/test/java/org/apache/commons/csv/CSVRecordTest.java
+++ b/src/test/java/org/apache/commons/csv/CSVRecordTest.java
@@ -41,9 +41,9 @@ public class CSVRecordTest {
         UNKNOWN_COLUMN
     }
 
-    private String[] values;
-    private CSVRecord record, recordWithHeader;
     private Map<String, Integer> headerMap;
+    private CSVRecord record, recordWithHeader;
+    private String[] values;
 
     @BeforeEach
     public void setUp() throws Exception {
@@ -134,13 +134,6 @@ public class CSVRecordTest {
     }
 
     @Test
-    public void testIsSetString() {
-        assertFalse(record.isSet("first"));
-        assertTrue(recordWithHeader.isSet("first"));
-        assertFalse(recordWithHeader.isSet("fourth"));
-    }
-
-    @Test
     public void testIsSetInt() {
         assertFalse(record.isSet(-1));
         assertTrue(record.isSet(0));
@@ -151,6 +144,13 @@ public class CSVRecordTest {
     }
 
     @Test
+    public void testIsSetString() {
+        assertFalse(record.isSet("first"));
+        assertTrue(recordWithHeader.isSet("first"));
+        assertFalse(recordWithHeader.isSet("fourth"));
+    }
+
+    @Test
     public void testIterator() {
         int i = 0;
         for (final String value : record) {
@@ -191,14 +191,6 @@ public class CSVRecordTest {
     }
 
     @Test
-    public void testToMapWithShortRecord() throws Exception {
-        try (final CSVParser parser = CSVParser.parse("a,b", CSVFormat.DEFAULT.withHeader("A", "B", "C"))) {
-            final CSVRecord shortRec = parser.iterator().next();
-            shortRec.toMap();
-        }
-    }
-
-    @Test
     public void testToMapWithNoHeader() throws Exception {
         try (final CSVParser parser = CSVParser.parse("a,b", CSVFormat.newFormat(','))) {
             final CSVRecord shortRec = parser.iterator().next();
@@ -208,6 +200,14 @@ public class CSVRecordTest {
         }
     }
 
+    @Test
+    public void testToMapWithShortRecord() throws Exception {
+        try (final CSVParser parser = CSVParser.parse("a,b", CSVFormat.DEFAULT.withHeader("A", "B", "C"))) {
+            final CSVRecord shortRec = parser.iterator().next();
+            shortRec.toMap();
+        }
+    }
+
     private void validateMap(final Map<String, String> map, final boolean allowsNulls) {
         assertTrue(map.containsKey("first"));
         assertTrue(map.containsKey("second"));