Fix odd local variable names.

This commit is contained in:
Gary Gregory 2019-06-14 20:24:15 -04:00
parent 50d727fc64
commit 2a6bcc1f73
1 changed files with 367 additions and 367 deletions

View File

@ -221,129 +221,129 @@ public class CSVFormatTest {
@Test @Test
public void testEqualsOne() { public void testEqualsOne() {
final CSVFormat cSVFormatOne = CSVFormat.INFORMIX_UNLOAD; final CSVFormat csvFormatOne = CSVFormat.INFORMIX_UNLOAD;
final CSVFormat cSVFormatTwo = CSVFormat.MYSQL; final CSVFormat csvFormatTwo = CSVFormat.MYSQL;
assertEquals('\\', (char)cSVFormatOne.getEscapeCharacter()); assertEquals('\\', (char)csvFormatOne.getEscapeCharacter());
assertNull(cSVFormatOne.getQuoteMode()); assertNull(csvFormatOne.getQuoteMode());
assertTrue(cSVFormatOne.getIgnoreEmptyLines()); assertTrue(csvFormatOne.getIgnoreEmptyLines());
assertFalse(cSVFormatOne.getSkipHeaderRecord()); assertFalse(csvFormatOne.getSkipHeaderRecord());
assertFalse(cSVFormatOne.getIgnoreHeaderCase()); assertFalse(csvFormatOne.getIgnoreHeaderCase());
assertNull(cSVFormatOne.getCommentMarker()); assertNull(csvFormatOne.getCommentMarker());
assertFalse(cSVFormatOne.isCommentMarkerSet()); assertFalse(csvFormatOne.isCommentMarkerSet());
assertTrue(cSVFormatOne.isQuoteCharacterSet()); assertTrue(csvFormatOne.isQuoteCharacterSet());
assertEquals('|', cSVFormatOne.getDelimiter()); assertEquals('|', csvFormatOne.getDelimiter());
assertFalse(cSVFormatOne.getAllowMissingColumnNames()); assertFalse(csvFormatOne.getAllowMissingColumnNames());
assertTrue(cSVFormatOne.isEscapeCharacterSet()); assertTrue(csvFormatOne.isEscapeCharacterSet());
assertEquals("\n", cSVFormatOne.getRecordSeparator()); assertEquals("\n", csvFormatOne.getRecordSeparator());
assertEquals('\"', (char)cSVFormatOne.getQuoteCharacter()); assertEquals('\"', (char)csvFormatOne.getQuoteCharacter());
assertFalse(cSVFormatOne.getTrailingDelimiter()); assertFalse(csvFormatOne.getTrailingDelimiter());
assertFalse(cSVFormatOne.getTrim()); assertFalse(csvFormatOne.getTrim());
assertFalse(cSVFormatOne.isNullStringSet()); assertFalse(csvFormatOne.isNullStringSet());
assertNull(cSVFormatOne.getNullString()); assertNull(csvFormatOne.getNullString());
assertFalse(cSVFormatOne.getIgnoreSurroundingSpaces()); assertFalse(csvFormatOne.getIgnoreSurroundingSpaces());
assertTrue(cSVFormatTwo.isEscapeCharacterSet()); assertTrue(csvFormatTwo.isEscapeCharacterSet());
assertNull(cSVFormatTwo.getQuoteCharacter()); assertNull(csvFormatTwo.getQuoteCharacter());
assertFalse(cSVFormatTwo.getAllowMissingColumnNames()); assertFalse(csvFormatTwo.getAllowMissingColumnNames());
assertEquals(QuoteMode.ALL_NON_NULL, cSVFormatTwo.getQuoteMode()); assertEquals(QuoteMode.ALL_NON_NULL, csvFormatTwo.getQuoteMode());
assertEquals('\t', cSVFormatTwo.getDelimiter()); assertEquals('\t', csvFormatTwo.getDelimiter());
assertEquals("\n", cSVFormatTwo.getRecordSeparator()); assertEquals("\n", csvFormatTwo.getRecordSeparator());
assertFalse(cSVFormatTwo.isQuoteCharacterSet()); assertFalse(csvFormatTwo.isQuoteCharacterSet());
assertTrue(cSVFormatTwo.isNullStringSet()); assertTrue(csvFormatTwo.isNullStringSet());
assertEquals('\\', (char)cSVFormatTwo.getEscapeCharacter()); assertEquals('\\', (char)csvFormatTwo.getEscapeCharacter());
assertFalse(cSVFormatTwo.getIgnoreHeaderCase()); assertFalse(csvFormatTwo.getIgnoreHeaderCase());
assertFalse(cSVFormatTwo.getTrim()); assertFalse(csvFormatTwo.getTrim());
assertFalse(cSVFormatTwo.getIgnoreEmptyLines()); assertFalse(csvFormatTwo.getIgnoreEmptyLines());
assertEquals("\\N", cSVFormatTwo.getNullString()); assertEquals("\\N", csvFormatTwo.getNullString());
assertFalse(cSVFormatTwo.getIgnoreSurroundingSpaces()); assertFalse(csvFormatTwo.getIgnoreSurroundingSpaces());
assertFalse(cSVFormatTwo.getTrailingDelimiter()); assertFalse(csvFormatTwo.getTrailingDelimiter());
assertFalse(cSVFormatTwo.getSkipHeaderRecord()); assertFalse(csvFormatTwo.getSkipHeaderRecord());
assertNull(cSVFormatTwo.getCommentMarker()); assertNull(csvFormatTwo.getCommentMarker());
assertFalse(cSVFormatTwo.isCommentMarkerSet()); assertFalse(csvFormatTwo.isCommentMarkerSet());
assertNotSame(cSVFormatTwo, cSVFormatOne); assertNotSame(csvFormatTwo, csvFormatOne);
assertFalse(cSVFormatTwo.equals(cSVFormatOne)); assertFalse(csvFormatTwo.equals(csvFormatOne));
assertEquals('\\', (char)cSVFormatOne.getEscapeCharacter()); assertEquals('\\', (char)csvFormatOne.getEscapeCharacter());
assertNull(cSVFormatOne.getQuoteMode()); assertNull(csvFormatOne.getQuoteMode());
assertTrue(cSVFormatOne.getIgnoreEmptyLines()); assertTrue(csvFormatOne.getIgnoreEmptyLines());
assertFalse(cSVFormatOne.getSkipHeaderRecord()); assertFalse(csvFormatOne.getSkipHeaderRecord());
assertFalse(cSVFormatOne.getIgnoreHeaderCase()); assertFalse(csvFormatOne.getIgnoreHeaderCase());
assertNull(cSVFormatOne.getCommentMarker()); assertNull(csvFormatOne.getCommentMarker());
assertFalse(cSVFormatOne.isCommentMarkerSet()); assertFalse(csvFormatOne.isCommentMarkerSet());
assertTrue(cSVFormatOne.isQuoteCharacterSet()); assertTrue(csvFormatOne.isQuoteCharacterSet());
assertEquals('|', cSVFormatOne.getDelimiter()); assertEquals('|', csvFormatOne.getDelimiter());
assertFalse(cSVFormatOne.getAllowMissingColumnNames()); assertFalse(csvFormatOne.getAllowMissingColumnNames());
assertTrue(cSVFormatOne.isEscapeCharacterSet()); assertTrue(csvFormatOne.isEscapeCharacterSet());
assertEquals("\n", cSVFormatOne.getRecordSeparator()); assertEquals("\n", csvFormatOne.getRecordSeparator());
assertEquals('\"', (char)cSVFormatOne.getQuoteCharacter()); assertEquals('\"', (char)csvFormatOne.getQuoteCharacter());
assertFalse(cSVFormatOne.getTrailingDelimiter()); assertFalse(csvFormatOne.getTrailingDelimiter());
assertFalse(cSVFormatOne.getTrim()); assertFalse(csvFormatOne.getTrim());
assertFalse(cSVFormatOne.isNullStringSet()); assertFalse(csvFormatOne.isNullStringSet());
assertNull(cSVFormatOne.getNullString()); assertNull(csvFormatOne.getNullString());
assertFalse(cSVFormatOne.getIgnoreSurroundingSpaces()); assertFalse(csvFormatOne.getIgnoreSurroundingSpaces());
assertTrue(cSVFormatTwo.isEscapeCharacterSet()); assertTrue(csvFormatTwo.isEscapeCharacterSet());
assertNull(cSVFormatTwo.getQuoteCharacter()); assertNull(csvFormatTwo.getQuoteCharacter());
assertFalse(cSVFormatTwo.getAllowMissingColumnNames()); assertFalse(csvFormatTwo.getAllowMissingColumnNames());
assertEquals(QuoteMode.ALL_NON_NULL, cSVFormatTwo.getQuoteMode()); assertEquals(QuoteMode.ALL_NON_NULL, csvFormatTwo.getQuoteMode());
assertEquals('\t', cSVFormatTwo.getDelimiter()); assertEquals('\t', csvFormatTwo.getDelimiter());
assertEquals("\n", cSVFormatTwo.getRecordSeparator()); assertEquals("\n", csvFormatTwo.getRecordSeparator());
assertFalse(cSVFormatTwo.isQuoteCharacterSet()); assertFalse(csvFormatTwo.isQuoteCharacterSet());
assertTrue(cSVFormatTwo.isNullStringSet()); assertTrue(csvFormatTwo.isNullStringSet());
assertEquals('\\', (char)cSVFormatTwo.getEscapeCharacter()); assertEquals('\\', (char)csvFormatTwo.getEscapeCharacter());
assertFalse(cSVFormatTwo.getIgnoreHeaderCase()); assertFalse(csvFormatTwo.getIgnoreHeaderCase());
assertFalse(cSVFormatTwo.getTrim()); assertFalse(csvFormatTwo.getTrim());
assertFalse(cSVFormatTwo.getIgnoreEmptyLines()); assertFalse(csvFormatTwo.getIgnoreEmptyLines());
assertEquals("\\N", cSVFormatTwo.getNullString()); assertEquals("\\N", csvFormatTwo.getNullString());
assertFalse(cSVFormatTwo.getIgnoreSurroundingSpaces()); assertFalse(csvFormatTwo.getIgnoreSurroundingSpaces());
assertFalse(cSVFormatTwo.getTrailingDelimiter()); assertFalse(csvFormatTwo.getTrailingDelimiter());
assertFalse(cSVFormatTwo.getSkipHeaderRecord()); assertFalse(csvFormatTwo.getSkipHeaderRecord());
assertNull(cSVFormatTwo.getCommentMarker()); assertNull(csvFormatTwo.getCommentMarker());
assertFalse(cSVFormatTwo.isCommentMarkerSet()); assertFalse(csvFormatTwo.isCommentMarkerSet());
assertNotSame(cSVFormatOne, cSVFormatTwo); assertNotSame(csvFormatOne, csvFormatTwo);
assertNotSame(cSVFormatTwo, cSVFormatOne); assertNotSame(csvFormatTwo, csvFormatOne);
assertFalse(cSVFormatOne.equals(cSVFormatTwo)); assertFalse(csvFormatOne.equals(csvFormatTwo));
assertFalse(cSVFormatTwo.equals(cSVFormatOne)); assertFalse(csvFormatTwo.equals(csvFormatOne));
assertFalse(cSVFormatTwo.equals(cSVFormatOne)); assertFalse(csvFormatTwo.equals(csvFormatOne));
} }
@ -403,63 +403,63 @@ public class CSVFormatTest {
@Test @Test
public void testEqualsWithNull() { public void testEqualsWithNull() {
final CSVFormat cSVFormat = CSVFormat.POSTGRESQL_TEXT; final CSVFormat csvFormat = CSVFormat.POSTGRESQL_TEXT;
assertEquals('\\', (char)cSVFormat.getEscapeCharacter()); assertEquals('\\', (char)csvFormat.getEscapeCharacter());
assertFalse(cSVFormat.getIgnoreSurroundingSpaces()); assertFalse(csvFormat.getIgnoreSurroundingSpaces());
assertFalse(cSVFormat.getTrailingDelimiter()); assertFalse(csvFormat.getTrailingDelimiter());
assertFalse(cSVFormat.getTrim()); assertFalse(csvFormat.getTrim());
assertTrue(cSVFormat.isQuoteCharacterSet()); assertTrue(csvFormat.isQuoteCharacterSet());
assertEquals("\\N", cSVFormat.getNullString()); assertEquals("\\N", csvFormat.getNullString());
assertFalse(cSVFormat.getIgnoreHeaderCase()); assertFalse(csvFormat.getIgnoreHeaderCase());
assertTrue(cSVFormat.isEscapeCharacterSet()); assertTrue(csvFormat.isEscapeCharacterSet());
assertFalse(cSVFormat.isCommentMarkerSet()); assertFalse(csvFormat.isCommentMarkerSet());
assertNull(cSVFormat.getCommentMarker()); assertNull(csvFormat.getCommentMarker());
assertFalse(cSVFormat.getAllowMissingColumnNames()); assertFalse(csvFormat.getAllowMissingColumnNames());
assertEquals(QuoteMode.ALL_NON_NULL, cSVFormat.getQuoteMode()); assertEquals(QuoteMode.ALL_NON_NULL, csvFormat.getQuoteMode());
assertEquals('\t', cSVFormat.getDelimiter()); assertEquals('\t', csvFormat.getDelimiter());
assertFalse(cSVFormat.getSkipHeaderRecord()); assertFalse(csvFormat.getSkipHeaderRecord());
assertEquals("\n", cSVFormat.getRecordSeparator()); assertEquals("\n", csvFormat.getRecordSeparator());
assertFalse(cSVFormat.getIgnoreEmptyLines()); assertFalse(csvFormat.getIgnoreEmptyLines());
assertEquals('\"', (char)cSVFormat.getQuoteCharacter()); assertEquals('\"', (char)csvFormat.getQuoteCharacter());
assertTrue(cSVFormat.isNullStringSet()); assertTrue(csvFormat.isNullStringSet());
assertEquals('\\', (char)cSVFormat.getEscapeCharacter()); assertEquals('\\', (char)csvFormat.getEscapeCharacter());
assertFalse(cSVFormat.getIgnoreSurroundingSpaces()); assertFalse(csvFormat.getIgnoreSurroundingSpaces());
assertFalse(cSVFormat.getTrailingDelimiter()); assertFalse(csvFormat.getTrailingDelimiter());
assertFalse(cSVFormat.getTrim()); assertFalse(csvFormat.getTrim());
assertTrue(cSVFormat.isQuoteCharacterSet()); assertTrue(csvFormat.isQuoteCharacterSet());
assertEquals("\\N", cSVFormat.getNullString()); assertEquals("\\N", csvFormat.getNullString());
assertFalse(cSVFormat.getIgnoreHeaderCase()); assertFalse(csvFormat.getIgnoreHeaderCase());
assertTrue(cSVFormat.isEscapeCharacterSet()); assertTrue(csvFormat.isEscapeCharacterSet());
assertFalse(cSVFormat.isCommentMarkerSet()); assertFalse(csvFormat.isCommentMarkerSet());
assertNull(cSVFormat.getCommentMarker()); assertNull(csvFormat.getCommentMarker());
assertFalse(cSVFormat.getAllowMissingColumnNames()); assertFalse(csvFormat.getAllowMissingColumnNames());
assertEquals(QuoteMode.ALL_NON_NULL, cSVFormat.getQuoteMode()); assertEquals(QuoteMode.ALL_NON_NULL, csvFormat.getQuoteMode());
assertEquals('\t', cSVFormat.getDelimiter()); assertEquals('\t', csvFormat.getDelimiter());
assertFalse(cSVFormat.getSkipHeaderRecord()); assertFalse(csvFormat.getSkipHeaderRecord());
assertEquals("\n", cSVFormat.getRecordSeparator()); assertEquals("\n", csvFormat.getRecordSeparator());
assertFalse(cSVFormat.getIgnoreEmptyLines()); assertFalse(csvFormat.getIgnoreEmptyLines());
assertEquals('\"', (char)cSVFormat.getQuoteCharacter()); assertEquals('\"', (char)csvFormat.getQuoteCharacter());
assertTrue(cSVFormat.isNullStringSet()); assertTrue(csvFormat.isNullStringSet());
assertFalse(cSVFormat.equals( null)); assertFalse(csvFormat.equals( null));
} }
@ -486,10 +486,10 @@ public class CSVFormatTest {
@Test //I assume this to be a defect. @Test //I assume this to be a defect.
public void testFormatThrowsNullPointerException() { public void testFormatThrowsNullPointerException() {
final CSVFormat cSVFormat = CSVFormat.MYSQL; final CSVFormat csvFormat = CSVFormat.MYSQL;
try { try {
cSVFormat.format((Object[]) null); csvFormat.format((Object[]) null);
fail("Expecting exception: NullPointerException"); fail("Expecting exception: NullPointerException");
} catch(final NullPointerException e) { } catch(final NullPointerException e) {
assertEquals(CSVFormat.class.getName(), e.getStackTrace()[0].getClassName()); assertEquals(CSVFormat.class.getName(), e.getStackTrace()[0].getClassName());
@ -513,78 +513,78 @@ public class CSVFormatTest {
@Test @Test
public void testHashCodeAndWithIgnoreHeaderCase() { public void testHashCodeAndWithIgnoreHeaderCase() {
final CSVFormat cSVFormat = CSVFormat.INFORMIX_UNLOAD_CSV; final CSVFormat csvFormat = CSVFormat.INFORMIX_UNLOAD_CSV;
final CSVFormat cSVFormatTwo = cSVFormat.withIgnoreHeaderCase(); final CSVFormat csvFormatTwo = csvFormat.withIgnoreHeaderCase();
cSVFormatTwo.hashCode(); csvFormatTwo.hashCode();
assertTrue(cSVFormatTwo.getIgnoreHeaderCase()); assertTrue(csvFormatTwo.getIgnoreHeaderCase());
assertFalse(cSVFormatTwo.getTrailingDelimiter()); assertFalse(csvFormatTwo.getTrailingDelimiter());
assertTrue(cSVFormatTwo.equals(cSVFormat)); // TODO this fails since CSV-242 was applied. Why should they compare equal? assertTrue(csvFormatTwo.equals(csvFormat)); // TODO this fails since CSV-242 was applied. Why should they compare equal?
assertFalse(cSVFormatTwo.getAllowMissingColumnNames()); assertFalse(csvFormatTwo.getAllowMissingColumnNames());
assertFalse(cSVFormatTwo.getTrim()); assertFalse(csvFormatTwo.getTrim());
} }
@Test @Test
public void testNewFormat() { public void testNewFormat() {
final CSVFormat cSVFormat = CSVFormat.newFormat('X'); final CSVFormat csvFormat = CSVFormat.newFormat('X');
assertFalse(cSVFormat.getSkipHeaderRecord()); assertFalse(csvFormat.getSkipHeaderRecord());
assertFalse(cSVFormat.isEscapeCharacterSet()); assertFalse(csvFormat.isEscapeCharacterSet());
assertNull(cSVFormat.getRecordSeparator()); assertNull(csvFormat.getRecordSeparator());
assertNull(cSVFormat.getQuoteMode()); assertNull(csvFormat.getQuoteMode());
assertNull(cSVFormat.getCommentMarker()); assertNull(csvFormat.getCommentMarker());
assertFalse(cSVFormat.getIgnoreHeaderCase()); assertFalse(csvFormat.getIgnoreHeaderCase());
assertFalse(cSVFormat.getAllowMissingColumnNames()); assertFalse(csvFormat.getAllowMissingColumnNames());
assertFalse(cSVFormat.getTrim()); assertFalse(csvFormat.getTrim());
assertFalse(cSVFormat.isNullStringSet()); assertFalse(csvFormat.isNullStringSet());
assertNull(cSVFormat.getEscapeCharacter()); assertNull(csvFormat.getEscapeCharacter());
assertFalse(cSVFormat.getIgnoreSurroundingSpaces()); assertFalse(csvFormat.getIgnoreSurroundingSpaces());
assertFalse(cSVFormat.getTrailingDelimiter()); assertFalse(csvFormat.getTrailingDelimiter());
assertEquals('X', cSVFormat.getDelimiter()); assertEquals('X', csvFormat.getDelimiter());
assertNull(cSVFormat.getNullString()); assertNull(csvFormat.getNullString());
assertFalse(cSVFormat.isQuoteCharacterSet()); assertFalse(csvFormat.isQuoteCharacterSet());
assertFalse(cSVFormat.isCommentMarkerSet()); assertFalse(csvFormat.isCommentMarkerSet());
assertNull(cSVFormat.getQuoteCharacter()); assertNull(csvFormat.getQuoteCharacter());
assertFalse(cSVFormat.getIgnoreEmptyLines()); assertFalse(csvFormat.getIgnoreEmptyLines());
assertFalse(cSVFormat.getSkipHeaderRecord()); assertFalse(csvFormat.getSkipHeaderRecord());
assertFalse(cSVFormat.isEscapeCharacterSet()); assertFalse(csvFormat.isEscapeCharacterSet());
assertNull(cSVFormat.getRecordSeparator()); assertNull(csvFormat.getRecordSeparator());
assertNull(cSVFormat.getQuoteMode()); assertNull(csvFormat.getQuoteMode());
assertNull(cSVFormat.getCommentMarker()); assertNull(csvFormat.getCommentMarker());
assertFalse(cSVFormat.getIgnoreHeaderCase()); assertFalse(csvFormat.getIgnoreHeaderCase());
assertFalse(cSVFormat.getAllowMissingColumnNames()); assertFalse(csvFormat.getAllowMissingColumnNames());
assertFalse(cSVFormat.getTrim()); assertFalse(csvFormat.getTrim());
assertFalse(cSVFormat.isNullStringSet()); assertFalse(csvFormat.isNullStringSet());
assertNull(cSVFormat.getEscapeCharacter()); assertNull(csvFormat.getEscapeCharacter());
assertFalse(cSVFormat.getIgnoreSurroundingSpaces()); assertFalse(csvFormat.getIgnoreSurroundingSpaces());
assertFalse(cSVFormat.getTrailingDelimiter()); assertFalse(csvFormat.getTrailingDelimiter());
assertEquals('X', cSVFormat.getDelimiter()); assertEquals('X', csvFormat.getDelimiter());
assertNull(cSVFormat.getNullString()); assertNull(csvFormat.getNullString());
assertFalse(cSVFormat.isQuoteCharacterSet()); assertFalse(csvFormat.isQuoteCharacterSet());
assertFalse(cSVFormat.isCommentMarkerSet()); assertFalse(csvFormat.isCommentMarkerSet());
assertNull(cSVFormat.getQuoteCharacter()); assertNull(csvFormat.getQuoteCharacter());
assertFalse(cSVFormat.getIgnoreEmptyLines()); assertFalse(csvFormat.getIgnoreEmptyLines());
} }
@ -663,162 +663,162 @@ public class CSVFormatTest {
@Test @Test
public void testToStringAndWithCommentMarkerTakingCharacter() { public void testToStringAndWithCommentMarkerTakingCharacter() {
final CSVFormat.Predefined cSVFormat_Predefined = CSVFormat.Predefined.Default; final CSVFormat.Predefined csvFormat_Predefined = CSVFormat.Predefined.Default;
final CSVFormat cSVFormat = cSVFormat_Predefined.getFormat(); final CSVFormat csvFormat = csvFormat_Predefined.getFormat();
assertNull(cSVFormat.getEscapeCharacter()); assertNull(csvFormat.getEscapeCharacter());
assertTrue(cSVFormat.isQuoteCharacterSet()); assertTrue(csvFormat.isQuoteCharacterSet());
assertFalse(cSVFormat.getTrim()); assertFalse(csvFormat.getTrim());
assertFalse(cSVFormat.getIgnoreSurroundingSpaces()); assertFalse(csvFormat.getIgnoreSurroundingSpaces());
assertFalse(cSVFormat.getTrailingDelimiter()); assertFalse(csvFormat.getTrailingDelimiter());
assertEquals(',', cSVFormat.getDelimiter()); assertEquals(',', csvFormat.getDelimiter());
assertFalse(cSVFormat.getIgnoreHeaderCase()); assertFalse(csvFormat.getIgnoreHeaderCase());
assertEquals("\r\n", cSVFormat.getRecordSeparator()); assertEquals("\r\n", csvFormat.getRecordSeparator());
assertFalse(cSVFormat.isCommentMarkerSet()); assertFalse(csvFormat.isCommentMarkerSet());
assertNull(cSVFormat.getCommentMarker()); assertNull(csvFormat.getCommentMarker());
assertFalse(cSVFormat.isNullStringSet()); assertFalse(csvFormat.isNullStringSet());
assertFalse(cSVFormat.getAllowMissingColumnNames()); assertFalse(csvFormat.getAllowMissingColumnNames());
assertFalse(cSVFormat.isEscapeCharacterSet()); assertFalse(csvFormat.isEscapeCharacterSet());
assertFalse(cSVFormat.getSkipHeaderRecord()); assertFalse(csvFormat.getSkipHeaderRecord());
assertNull(cSVFormat.getNullString()); assertNull(csvFormat.getNullString());
assertNull(cSVFormat.getQuoteMode()); assertNull(csvFormat.getQuoteMode());
assertTrue(cSVFormat.getIgnoreEmptyLines()); assertTrue(csvFormat.getIgnoreEmptyLines());
assertEquals('\"', (char)cSVFormat.getQuoteCharacter()); assertEquals('\"', (char)csvFormat.getQuoteCharacter());
final Character character = Character.valueOf('n'); final Character character = Character.valueOf('n');
final CSVFormat cSVFormatTwo = cSVFormat.withCommentMarker(character); final CSVFormat csvFormatTwo = csvFormat.withCommentMarker(character);
assertNull(cSVFormat.getEscapeCharacter()); assertNull(csvFormat.getEscapeCharacter());
assertTrue(cSVFormat.isQuoteCharacterSet()); assertTrue(csvFormat.isQuoteCharacterSet());
assertFalse(cSVFormat.getTrim()); assertFalse(csvFormat.getTrim());
assertFalse(cSVFormat.getIgnoreSurroundingSpaces()); assertFalse(csvFormat.getIgnoreSurroundingSpaces());
assertFalse(cSVFormat.getTrailingDelimiter()); assertFalse(csvFormat.getTrailingDelimiter());
assertEquals(',', cSVFormat.getDelimiter()); assertEquals(',', csvFormat.getDelimiter());
assertFalse(cSVFormat.getIgnoreHeaderCase()); assertFalse(csvFormat.getIgnoreHeaderCase());
assertEquals("\r\n", cSVFormat.getRecordSeparator()); assertEquals("\r\n", csvFormat.getRecordSeparator());
assertFalse(cSVFormat.isCommentMarkerSet()); assertFalse(csvFormat.isCommentMarkerSet());
assertNull(cSVFormat.getCommentMarker()); assertNull(csvFormat.getCommentMarker());
assertFalse(cSVFormat.isNullStringSet()); assertFalse(csvFormat.isNullStringSet());
assertFalse(cSVFormat.getAllowMissingColumnNames()); assertFalse(csvFormat.getAllowMissingColumnNames());
assertFalse(cSVFormat.isEscapeCharacterSet()); assertFalse(csvFormat.isEscapeCharacterSet());
assertFalse(cSVFormat.getSkipHeaderRecord()); assertFalse(csvFormat.getSkipHeaderRecord());
assertNull(cSVFormat.getNullString()); assertNull(csvFormat.getNullString());
assertNull(cSVFormat.getQuoteMode()); assertNull(csvFormat.getQuoteMode());
assertTrue(cSVFormat.getIgnoreEmptyLines()); assertTrue(csvFormat.getIgnoreEmptyLines());
assertEquals('\"', (char)cSVFormat.getQuoteCharacter()); assertEquals('\"', (char)csvFormat.getQuoteCharacter());
assertFalse(cSVFormatTwo.isNullStringSet()); assertFalse(csvFormatTwo.isNullStringSet());
assertFalse(cSVFormatTwo.getAllowMissingColumnNames()); assertFalse(csvFormatTwo.getAllowMissingColumnNames());
assertEquals('\"', (char)cSVFormatTwo.getQuoteCharacter()); assertEquals('\"', (char)csvFormatTwo.getQuoteCharacter());
assertNull(cSVFormatTwo.getNullString()); assertNull(csvFormatTwo.getNullString());
assertEquals(',', cSVFormatTwo.getDelimiter()); assertEquals(',', csvFormatTwo.getDelimiter());
assertFalse(cSVFormatTwo.getTrailingDelimiter()); assertFalse(csvFormatTwo.getTrailingDelimiter());
assertTrue(cSVFormatTwo.isCommentMarkerSet()); assertTrue(csvFormatTwo.isCommentMarkerSet());
assertFalse(cSVFormatTwo.getIgnoreHeaderCase()); assertFalse(csvFormatTwo.getIgnoreHeaderCase());
assertFalse(cSVFormatTwo.getTrim()); assertFalse(csvFormatTwo.getTrim());
assertNull(cSVFormatTwo.getEscapeCharacter()); assertNull(csvFormatTwo.getEscapeCharacter());
assertTrue(cSVFormatTwo.isQuoteCharacterSet()); assertTrue(csvFormatTwo.isQuoteCharacterSet());
assertFalse(cSVFormatTwo.getIgnoreSurroundingSpaces()); assertFalse(csvFormatTwo.getIgnoreSurroundingSpaces());
assertEquals("\r\n", cSVFormatTwo.getRecordSeparator()); assertEquals("\r\n", csvFormatTwo.getRecordSeparator());
assertNull(cSVFormatTwo.getQuoteMode()); assertNull(csvFormatTwo.getQuoteMode());
assertEquals('n', (char)cSVFormatTwo.getCommentMarker()); assertEquals('n', (char)csvFormatTwo.getCommentMarker());
assertFalse(cSVFormatTwo.getSkipHeaderRecord()); assertFalse(csvFormatTwo.getSkipHeaderRecord());
assertFalse(cSVFormatTwo.isEscapeCharacterSet()); assertFalse(csvFormatTwo.isEscapeCharacterSet());
assertTrue(cSVFormatTwo.getIgnoreEmptyLines()); assertTrue(csvFormatTwo.getIgnoreEmptyLines());
assertNotSame(cSVFormat, cSVFormatTwo); assertNotSame(csvFormat, csvFormatTwo);
assertNotSame(cSVFormatTwo, cSVFormat); assertNotSame(csvFormatTwo, csvFormat);
assertFalse(cSVFormatTwo.equals(cSVFormat)); assertFalse(csvFormatTwo.equals(csvFormat));
assertNull(cSVFormat.getEscapeCharacter()); assertNull(csvFormat.getEscapeCharacter());
assertTrue(cSVFormat.isQuoteCharacterSet()); assertTrue(csvFormat.isQuoteCharacterSet());
assertFalse(cSVFormat.getTrim()); assertFalse(csvFormat.getTrim());
assertFalse(cSVFormat.getIgnoreSurroundingSpaces()); assertFalse(csvFormat.getIgnoreSurroundingSpaces());
assertFalse(cSVFormat.getTrailingDelimiter()); assertFalse(csvFormat.getTrailingDelimiter());
assertEquals(',', cSVFormat.getDelimiter()); assertEquals(',', csvFormat.getDelimiter());
assertFalse(cSVFormat.getIgnoreHeaderCase()); assertFalse(csvFormat.getIgnoreHeaderCase());
assertEquals("\r\n", cSVFormat.getRecordSeparator()); assertEquals("\r\n", csvFormat.getRecordSeparator());
assertFalse(cSVFormat.isCommentMarkerSet()); assertFalse(csvFormat.isCommentMarkerSet());
assertNull(cSVFormat.getCommentMarker()); assertNull(csvFormat.getCommentMarker());
assertFalse(cSVFormat.isNullStringSet()); assertFalse(csvFormat.isNullStringSet());
assertFalse(cSVFormat.getAllowMissingColumnNames()); assertFalse(csvFormat.getAllowMissingColumnNames());
assertFalse(cSVFormat.isEscapeCharacterSet()); assertFalse(csvFormat.isEscapeCharacterSet());
assertFalse(cSVFormat.getSkipHeaderRecord()); assertFalse(csvFormat.getSkipHeaderRecord());
assertNull(cSVFormat.getNullString()); assertNull(csvFormat.getNullString());
assertNull(cSVFormat.getQuoteMode()); assertNull(csvFormat.getQuoteMode());
assertTrue(cSVFormat.getIgnoreEmptyLines()); assertTrue(csvFormat.getIgnoreEmptyLines());
assertEquals('\"', (char)cSVFormat.getQuoteCharacter()); assertEquals('\"', (char)csvFormat.getQuoteCharacter());
assertFalse(cSVFormatTwo.isNullStringSet()); assertFalse(csvFormatTwo.isNullStringSet());
assertFalse(cSVFormatTwo.getAllowMissingColumnNames()); assertFalse(csvFormatTwo.getAllowMissingColumnNames());
assertEquals('\"', (char)cSVFormatTwo.getQuoteCharacter()); assertEquals('\"', (char)csvFormatTwo.getQuoteCharacter());
assertNull(cSVFormatTwo.getNullString()); assertNull(csvFormatTwo.getNullString());
assertEquals(',', cSVFormatTwo.getDelimiter()); assertEquals(',', csvFormatTwo.getDelimiter());
assertFalse(cSVFormatTwo.getTrailingDelimiter()); assertFalse(csvFormatTwo.getTrailingDelimiter());
assertTrue(cSVFormatTwo.isCommentMarkerSet()); assertTrue(csvFormatTwo.isCommentMarkerSet());
assertFalse(cSVFormatTwo.getIgnoreHeaderCase()); assertFalse(csvFormatTwo.getIgnoreHeaderCase());
assertFalse(cSVFormatTwo.getTrim()); assertFalse(csvFormatTwo.getTrim());
assertNull(cSVFormatTwo.getEscapeCharacter()); assertNull(csvFormatTwo.getEscapeCharacter());
assertTrue(cSVFormatTwo.isQuoteCharacterSet()); assertTrue(csvFormatTwo.isQuoteCharacterSet());
assertFalse(cSVFormatTwo.getIgnoreSurroundingSpaces()); assertFalse(csvFormatTwo.getIgnoreSurroundingSpaces());
assertEquals("\r\n", cSVFormatTwo.getRecordSeparator()); assertEquals("\r\n", csvFormatTwo.getRecordSeparator());
assertNull(cSVFormatTwo.getQuoteMode()); assertNull(csvFormatTwo.getQuoteMode());
assertEquals('n', (char)cSVFormatTwo.getCommentMarker()); assertEquals('n', (char)csvFormatTwo.getCommentMarker());
assertFalse(cSVFormatTwo.getSkipHeaderRecord()); assertFalse(csvFormatTwo.getSkipHeaderRecord());
assertFalse(cSVFormatTwo.isEscapeCharacterSet()); assertFalse(csvFormatTwo.isEscapeCharacterSet());
assertTrue(cSVFormatTwo.getIgnoreEmptyLines()); assertTrue(csvFormatTwo.getIgnoreEmptyLines());
assertNotSame(cSVFormat, cSVFormatTwo); assertNotSame(csvFormat, csvFormatTwo);
assertNotSame(cSVFormatTwo, cSVFormat); assertNotSame(csvFormatTwo, csvFormat);
assertFalse(cSVFormat.equals(cSVFormatTwo)); assertFalse(csvFormat.equals(csvFormatTwo));
assertFalse(cSVFormatTwo.equals(cSVFormat)); assertFalse(csvFormatTwo.equals(csvFormat));
assertEquals("Delimiter=<,> QuoteChar=<\"> CommentStart=<n> " + assertEquals("Delimiter=<,> QuoteChar=<\"> CommentStart=<n> " +
"RecordSeparator=<\r\n> EmptyLines:ignored SkipHeaderRecord:false" "RecordSeparator=<\r\n> EmptyLines:ignored SkipHeaderRecord:false"
, cSVFormatTwo.toString()); , csvFormatTwo.toString());
} }
@ -880,160 +880,160 @@ public class CSVFormatTest {
@Test @Test
public void testWithHeaderComments() { public void testWithHeaderComments() {
final CSVFormat cSVFormat = CSVFormat.DEFAULT; final CSVFormat csvFormat = CSVFormat.DEFAULT;
assertEquals('\"', (char)cSVFormat.getQuoteCharacter()); assertEquals('\"', (char)csvFormat.getQuoteCharacter());
assertFalse(cSVFormat.isCommentMarkerSet()); assertFalse(csvFormat.isCommentMarkerSet());
assertFalse(cSVFormat.isEscapeCharacterSet()); assertFalse(csvFormat.isEscapeCharacterSet());
assertTrue(cSVFormat.isQuoteCharacterSet()); assertTrue(csvFormat.isQuoteCharacterSet());
assertFalse(cSVFormat.getSkipHeaderRecord()); assertFalse(csvFormat.getSkipHeaderRecord());
assertNull(cSVFormat.getQuoteMode()); assertNull(csvFormat.getQuoteMode());
assertEquals(',', cSVFormat.getDelimiter()); assertEquals(',', csvFormat.getDelimiter());
assertTrue(cSVFormat.getIgnoreEmptyLines()); assertTrue(csvFormat.getIgnoreEmptyLines());
assertFalse(cSVFormat.getIgnoreHeaderCase()); assertFalse(csvFormat.getIgnoreHeaderCase());
assertNull(cSVFormat.getCommentMarker()); assertNull(csvFormat.getCommentMarker());
assertEquals("\r\n", cSVFormat.getRecordSeparator()); assertEquals("\r\n", csvFormat.getRecordSeparator());
assertFalse(cSVFormat.getTrailingDelimiter()); assertFalse(csvFormat.getTrailingDelimiter());
assertFalse(cSVFormat.getAllowMissingColumnNames()); assertFalse(csvFormat.getAllowMissingColumnNames());
assertFalse(cSVFormat.getTrim()); assertFalse(csvFormat.getTrim());
assertFalse(cSVFormat.isNullStringSet()); assertFalse(csvFormat.isNullStringSet());
assertNull(cSVFormat.getNullString()); assertNull(csvFormat.getNullString());
assertFalse(cSVFormat.getIgnoreSurroundingSpaces()); assertFalse(csvFormat.getIgnoreSurroundingSpaces());
assertNull(cSVFormat.getEscapeCharacter()); assertNull(csvFormat.getEscapeCharacter());
final Object[] objectArray = new Object[8]; final Object[] objectArray = new Object[8];
final CSVFormat cSVFormatTwo = cSVFormat.withHeaderComments(objectArray); final CSVFormat csvFormatTwo = csvFormat.withHeaderComments(objectArray);
assertEquals('\"', (char)cSVFormat.getQuoteCharacter()); assertEquals('\"', (char)csvFormat.getQuoteCharacter());
assertFalse(cSVFormat.isCommentMarkerSet()); assertFalse(csvFormat.isCommentMarkerSet());
assertFalse(cSVFormat.isEscapeCharacterSet()); assertFalse(csvFormat.isEscapeCharacterSet());
assertTrue(cSVFormat.isQuoteCharacterSet()); assertTrue(csvFormat.isQuoteCharacterSet());
assertFalse(cSVFormat.getSkipHeaderRecord()); assertFalse(csvFormat.getSkipHeaderRecord());
assertNull(cSVFormat.getQuoteMode()); assertNull(csvFormat.getQuoteMode());
assertEquals(',', cSVFormat.getDelimiter()); assertEquals(',', csvFormat.getDelimiter());
assertTrue(cSVFormat.getIgnoreEmptyLines()); assertTrue(csvFormat.getIgnoreEmptyLines());
assertFalse(cSVFormat.getIgnoreHeaderCase()); assertFalse(csvFormat.getIgnoreHeaderCase());
assertNull(cSVFormat.getCommentMarker()); assertNull(csvFormat.getCommentMarker());
assertEquals("\r\n", cSVFormat.getRecordSeparator()); assertEquals("\r\n", csvFormat.getRecordSeparator());
assertFalse(cSVFormat.getTrailingDelimiter()); assertFalse(csvFormat.getTrailingDelimiter());
assertFalse(cSVFormat.getAllowMissingColumnNames()); assertFalse(csvFormat.getAllowMissingColumnNames());
assertFalse(cSVFormat.getTrim()); assertFalse(csvFormat.getTrim());
assertFalse(cSVFormat.isNullStringSet()); assertFalse(csvFormat.isNullStringSet());
assertNull(cSVFormat.getNullString()); assertNull(csvFormat.getNullString());
assertFalse(cSVFormat.getIgnoreSurroundingSpaces()); assertFalse(csvFormat.getIgnoreSurroundingSpaces());
assertNull(cSVFormat.getEscapeCharacter()); assertNull(csvFormat.getEscapeCharacter());
assertFalse(cSVFormatTwo.getIgnoreHeaderCase()); assertFalse(csvFormatTwo.getIgnoreHeaderCase());
assertNull(cSVFormatTwo.getQuoteMode()); assertNull(csvFormatTwo.getQuoteMode());
assertTrue(cSVFormatTwo.getIgnoreEmptyLines()); assertTrue(csvFormatTwo.getIgnoreEmptyLines());
assertFalse(cSVFormatTwo.getIgnoreSurroundingSpaces()); assertFalse(csvFormatTwo.getIgnoreSurroundingSpaces());
assertNull(cSVFormatTwo.getEscapeCharacter()); assertNull(csvFormatTwo.getEscapeCharacter());
assertFalse(cSVFormatTwo.getTrim()); assertFalse(csvFormatTwo.getTrim());
assertFalse(cSVFormatTwo.isEscapeCharacterSet()); assertFalse(csvFormatTwo.isEscapeCharacterSet());
assertTrue(cSVFormatTwo.isQuoteCharacterSet()); assertTrue(csvFormatTwo.isQuoteCharacterSet());
assertFalse(cSVFormatTwo.getSkipHeaderRecord()); assertFalse(csvFormatTwo.getSkipHeaderRecord());
assertEquals('\"', (char)cSVFormatTwo.getQuoteCharacter()); assertEquals('\"', (char)csvFormatTwo.getQuoteCharacter());
assertFalse(cSVFormatTwo.getAllowMissingColumnNames()); assertFalse(csvFormatTwo.getAllowMissingColumnNames());
assertNull(cSVFormatTwo.getNullString()); assertNull(csvFormatTwo.getNullString());
assertFalse(cSVFormatTwo.isNullStringSet()); assertFalse(csvFormatTwo.isNullStringSet());
assertFalse(cSVFormatTwo.getTrailingDelimiter()); assertFalse(csvFormatTwo.getTrailingDelimiter());
assertEquals("\r\n", cSVFormatTwo.getRecordSeparator()); assertEquals("\r\n", csvFormatTwo.getRecordSeparator());
assertEquals(',', cSVFormatTwo.getDelimiter()); assertEquals(',', csvFormatTwo.getDelimiter());
assertNull(cSVFormatTwo.getCommentMarker()); assertNull(csvFormatTwo.getCommentMarker());
assertFalse(cSVFormatTwo.isCommentMarkerSet()); assertFalse(csvFormatTwo.isCommentMarkerSet());
assertNotSame(cSVFormat, cSVFormatTwo); assertNotSame(csvFormat, csvFormatTwo);
assertNotSame(cSVFormatTwo, cSVFormat); assertNotSame(csvFormatTwo, csvFormat);
assertTrue(cSVFormatTwo.equals(cSVFormat)); // TODO this fails since CSV-242 was applied. Why should the formats compare equal? assertTrue(csvFormatTwo.equals(csvFormat)); // TODO this fails since CSV-242 was applied. Why should the formats compare equal?
final String string = cSVFormatTwo.format(objectArray); final String string = csvFormatTwo.format(objectArray);
assertEquals('\"', (char)cSVFormat.getQuoteCharacter()); assertEquals('\"', (char)csvFormat.getQuoteCharacter());
assertFalse(cSVFormat.isCommentMarkerSet()); assertFalse(csvFormat.isCommentMarkerSet());
assertFalse(cSVFormat.isEscapeCharacterSet()); assertFalse(csvFormat.isEscapeCharacterSet());
assertTrue(cSVFormat.isQuoteCharacterSet()); assertTrue(csvFormat.isQuoteCharacterSet());
assertFalse(cSVFormat.getSkipHeaderRecord()); assertFalse(csvFormat.getSkipHeaderRecord());
assertNull(cSVFormat.getQuoteMode()); assertNull(csvFormat.getQuoteMode());
assertEquals(',', cSVFormat.getDelimiter()); assertEquals(',', csvFormat.getDelimiter());
assertTrue(cSVFormat.getIgnoreEmptyLines()); assertTrue(csvFormat.getIgnoreEmptyLines());
assertFalse(cSVFormat.getIgnoreHeaderCase()); assertFalse(csvFormat.getIgnoreHeaderCase());
assertNull(cSVFormat.getCommentMarker()); assertNull(csvFormat.getCommentMarker());
assertEquals("\r\n", cSVFormat.getRecordSeparator()); assertEquals("\r\n", csvFormat.getRecordSeparator());
assertFalse(cSVFormat.getTrailingDelimiter()); assertFalse(csvFormat.getTrailingDelimiter());
assertFalse(cSVFormat.getAllowMissingColumnNames()); assertFalse(csvFormat.getAllowMissingColumnNames());
assertFalse(cSVFormat.getTrim()); assertFalse(csvFormat.getTrim());
assertFalse(cSVFormat.isNullStringSet()); assertFalse(csvFormat.isNullStringSet());
assertNull(cSVFormat.getNullString()); assertNull(csvFormat.getNullString());
assertFalse(cSVFormat.getIgnoreSurroundingSpaces()); assertFalse(csvFormat.getIgnoreSurroundingSpaces());
assertNull(cSVFormat.getEscapeCharacter()); assertNull(csvFormat.getEscapeCharacter());
assertFalse(cSVFormatTwo.getIgnoreHeaderCase()); assertFalse(csvFormatTwo.getIgnoreHeaderCase());
assertNull(cSVFormatTwo.getQuoteMode()); assertNull(csvFormatTwo.getQuoteMode());
assertTrue(cSVFormatTwo.getIgnoreEmptyLines()); assertTrue(csvFormatTwo.getIgnoreEmptyLines());
assertFalse(cSVFormatTwo.getIgnoreSurroundingSpaces()); assertFalse(csvFormatTwo.getIgnoreSurroundingSpaces());
assertNull(cSVFormatTwo.getEscapeCharacter()); assertNull(csvFormatTwo.getEscapeCharacter());
assertFalse(cSVFormatTwo.getTrim()); assertFalse(csvFormatTwo.getTrim());
assertFalse(cSVFormatTwo.isEscapeCharacterSet()); assertFalse(csvFormatTwo.isEscapeCharacterSet());
assertTrue(cSVFormatTwo.isQuoteCharacterSet()); assertTrue(csvFormatTwo.isQuoteCharacterSet());
assertFalse(cSVFormatTwo.getSkipHeaderRecord()); assertFalse(csvFormatTwo.getSkipHeaderRecord());
assertEquals('\"', (char)cSVFormatTwo.getQuoteCharacter()); assertEquals('\"', (char)csvFormatTwo.getQuoteCharacter());
assertFalse(cSVFormatTwo.getAllowMissingColumnNames()); assertFalse(csvFormatTwo.getAllowMissingColumnNames());
assertNull(cSVFormatTwo.getNullString()); assertNull(csvFormatTwo.getNullString());
assertFalse(cSVFormatTwo.isNullStringSet()); assertFalse(csvFormatTwo.isNullStringSet());
assertFalse(cSVFormatTwo.getTrailingDelimiter()); assertFalse(csvFormatTwo.getTrailingDelimiter());
assertEquals("\r\n", cSVFormatTwo.getRecordSeparator()); assertEquals("\r\n", csvFormatTwo.getRecordSeparator());
assertEquals(',', cSVFormatTwo.getDelimiter()); assertEquals(',', csvFormatTwo.getDelimiter());
assertNull(cSVFormatTwo.getCommentMarker()); assertNull(csvFormatTwo.getCommentMarker());
assertFalse(cSVFormatTwo.isCommentMarkerSet()); assertFalse(csvFormatTwo.isCommentMarkerSet());
assertNotSame(cSVFormat, cSVFormatTwo); assertNotSame(csvFormat, csvFormatTwo);
assertNotSame(cSVFormatTwo, cSVFormat); assertNotSame(csvFormatTwo, csvFormat);
assertNotNull(string); assertNotNull(string);
assertTrue(cSVFormat.equals(cSVFormatTwo)); assertTrue(csvFormat.equals(csvFormatTwo));
assertTrue(cSVFormatTwo.equals(cSVFormat)); assertTrue(csvFormatTwo.equals(csvFormat));
assertEquals(",,,,,,,", string); assertEquals(",,,,,,,", string);
} }