@@ -65,7 +65,7 @@ public void testDuplicateHeaderElements() {
6565 @ Test
6666 public void testEquals () {
6767 final CSVFormat right = CSVFormat .DEFAULT ;
68- final CSVFormat left = CSVFormat . copy (right );
68+ final CSVFormat left = copy (right );
6969
7070 assertFalse (right .equals (null ));
7171 assertFalse (right .equals ("A String Instance" ));
@@ -84,7 +84,7 @@ public void testEqualsCommentStart() {
8484 .withQuoteChar ('"' )
8585 .withCommentStart ('#' )
8686 .withQuotePolicy (Quote .ALL );
87- final CSVFormat left = CSVFormat . copy ( right )
87+ final CSVFormat left = right
8888 .withCommentStart ('!' );
8989
9090 assertNotEquals (right , left );
@@ -105,7 +105,7 @@ public void testEqualsEscape() {
105105 .withCommentStart ('#' )
106106 .withEscape ('+' )
107107 .withQuotePolicy (Quote .ALL );
108- final CSVFormat left = CSVFormat . copy ( right )
108+ final CSVFormat left = right
109109 .withEscape ('!' );
110110
111111 assertNotEquals (right , left );
@@ -122,7 +122,7 @@ public void testEqualsHeader() {
122122 .withIgnoreSurroundingSpaces (true )
123123 .withQuoteChar ('"' )
124124 .withQuotePolicy (Quote .ALL );
125- final CSVFormat left = CSVFormat . copy ( right )
125+ final CSVFormat left = right
126126 .withHeader ("Three" , "Two" , "One" );
127127
128128 assertNotEquals (right , left );
@@ -137,7 +137,7 @@ public void testEqualsIgnoreEmptyLines() {
137137 .withIgnoreSurroundingSpaces (true )
138138 .withQuoteChar ('"' )
139139 .withQuotePolicy (Quote .ALL );
140- final CSVFormat left = CSVFormat . copy ( right )
140+ final CSVFormat left = right
141141 .withIgnoreEmptyLines (false );
142142
143143 assertNotEquals (right , left );
@@ -151,7 +151,7 @@ public void testEqualsIgnoreSurroundingSpaces() {
151151 .withIgnoreSurroundingSpaces (true )
152152 .withQuoteChar ('"' )
153153 .withQuotePolicy (Quote .ALL );
154- final CSVFormat left = CSVFormat . copy ( right )
154+ final CSVFormat left = right
155155 .withIgnoreSurroundingSpaces (false );
156156
157157 assertNotEquals (right , left );
@@ -160,7 +160,7 @@ public void testEqualsIgnoreSurroundingSpaces() {
160160 @ Test
161161 public void testEqualsQuoteChar () {
162162 final CSVFormat right = CSVFormat .newFormat ('\'' ).withQuoteChar ('"' );
163- final CSVFormat left = CSVFormat . copy ( right ) .withQuoteChar ('!' );
163+ final CSVFormat left = right .withQuoteChar ('!' );
164164
165165 assertNotEquals (right , left );
166166 }
@@ -170,7 +170,7 @@ public void testEqualsQuotePolicy() {
170170 final CSVFormat right = CSVFormat .newFormat ('\'' )
171171 .withQuoteChar ('"' )
172172 .withQuotePolicy (Quote .ALL );
173- final CSVFormat left = CSVFormat . copy ( right )
173+ final CSVFormat left = right
174174 .withQuotePolicy (Quote .MINIMAL );
175175
176176 assertNotEquals (right , left );
@@ -186,7 +186,7 @@ public void testEqualsRecordSeparator() {
186186 .withIgnoreSurroundingSpaces (true )
187187 .withQuoteChar ('"' )
188188 .withQuotePolicy (Quote .ALL );
189- final CSVFormat left = CSVFormat . copy ( right )
189+ final CSVFormat left = right
190190 .withRecordSeparator ('!' );
191191
192192 assertNotEquals (right , left );
@@ -366,4 +366,8 @@ public void testWithRecordSeparator() throws Exception {
366366 CSVFormat formatWithRecordSeparator = CSVFormat .DEFAULT .withRecordSeparator ('!' );
367367 assertEquals ("!" , formatWithRecordSeparator .getRecordSeparator ());
368368 }
369+
370+ private static CSVFormat copy (final CSVFormat format ) {
371+ return format .withDelimiter (format .getDelimiter ());
372+ }
369373}
0 commit comments