[CSV-248] CSVRecord is not Serializable.

Sort members.
This commit is contained in:
Gary Gregory 2020-01-20 18:34:31 -05:00
parent d6778b74a1
commit d047f83c28
1 changed files with 17 additions and 17 deletions

View File

@ -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 {
@ -133,13 +133,6 @@ public class CSVRecordTest {
assertFalse(recordWithHeader.isMapped("fourth"));
}
@Test
public void testIsSetString() {
assertFalse(record.isSet("first"));
assertTrue(recordWithHeader.isSet("first"));
assertFalse(recordWithHeader.isSet("fourth"));
}
@Test
public void testIsSetInt() {
assertFalse(record.isSet(-1));
@ -150,6 +143,13 @@ public class CSVRecordTest {
assertFalse(recordWithHeader.isSet(1000));
}
@Test
public void testIsSetString() {
assertFalse(record.isSet("first"));
assertTrue(recordWithHeader.isSet("first"));
assertFalse(recordWithHeader.isSet("fourth"));
}
@Test
public void testIterator() {
int i = 0;
@ -190,14 +190,6 @@ public class CSVRecordTest {
this.validateMap(map, true);
}
@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(','))) {
@ -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"));