Skip to content

Commit 33f662b

Browse files
committed
Fix compiler warning.
1 parent 5c0d27c commit 33f662b

1 file changed

Lines changed: 20 additions & 19 deletions

File tree

src/test/java/org/apache/commons/csv/CSVPrinterTest.java

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,33 +1352,34 @@ public void testCloseWithFlushOff() throws IOException {
13521352

13531353
@Test
13541354
public void testCloseBackwardCompatibility() throws IOException {
1355-
final Writer writer = mock(Writer.class);
1356-
final CSVFormat csvFormat = CSVFormat.DEFAULT;
1357-
try (CSVPrinter csvPrinter = new CSVPrinter(writer, csvFormat)) {
1358-
}
1359-
verify(writer, never()).flush();
1360-
verify(writer, times(1)).close();
1361-
}
1355+
try (final Writer writer = mock(Writer.class)) {
1356+
final CSVFormat csvFormat = CSVFormat.DEFAULT;
1357+
try (CSVPrinter csvPrinter = new CSVPrinter(writer, csvFormat)) {
1358+
}
1359+
verify(writer, never()).flush();
1360+
verify(writer, times(1)).close();
1361+
}}
13621362

13631363
@Test
13641364
public void testCloseWithCsvFormatAutoFlushOn() throws IOException {
13651365
// System.out.println("start method");
1366-
final Writer writer = mock(Writer.class);
1367-
final CSVFormat csvFormat = CSVFormat.DEFAULT.withAutoFlush(true);
1368-
try (CSVPrinter csvPrinter = new CSVPrinter(writer, csvFormat)) {
1369-
}
1370-
verify(writer, times(1)).flush();
1371-
verify(writer, times(1)).close();
1372-
}
1366+
try (final Writer writer = mock(Writer.class)) {
1367+
final CSVFormat csvFormat = CSVFormat.DEFAULT.withAutoFlush(true);
1368+
try (CSVPrinter csvPrinter = new CSVPrinter(writer, csvFormat)) {
1369+
}
1370+
verify(writer, times(1)).flush();
1371+
verify(writer, times(1)).close();
1372+
}}
13731373

13741374
@Test
13751375
public void testCloseWithCsvFormatAutoFlushOff() throws IOException {
1376-
final Writer writer = mock(Writer.class);
1377-
final CSVFormat csvFormat = CSVFormat.DEFAULT.withAutoFlush(false);
1378-
try (CSVPrinter csvPrinter = new CSVPrinter(writer, csvFormat)) {
1376+
try (final Writer writer = mock(Writer.class)) {
1377+
final CSVFormat csvFormat = CSVFormat.DEFAULT.withAutoFlush(false);
1378+
try (CSVPrinter csvPrinter = new CSVPrinter(writer, csvFormat)) {
1379+
}
1380+
verify(writer, never()).flush();
1381+
verify(writer, times(1)).close();
13791382
}
1380-
verify(writer, never()).flush();
1381-
verify(writer, times(1)).close();
13821383
}
13831384

13841385
}

0 commit comments

Comments
 (0)