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 2019/02/24 15:11:31 UTC
[commons-csv] branch master updated: Address compiler warnings.
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
The following commit(s) were added to refs/heads/master by this push:
new bf3f34c Address compiler warnings.
bf3f34c is described below
commit bf3f34c8b5ff4beaae5da9f33620dad33ef07fa3
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 24 10:11:29 2019 -0500
Address compiler warnings.
---
.../org/apache/commons/csv/CSVPrinterTest.java | 28 ++++++++++++----------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/src/test/java/org/apache/commons/csv/CSVPrinterTest.java b/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
index 53a690e..18856cf 100644
--- a/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
+++ b/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
@@ -53,8 +53,6 @@ import java.util.Vector;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.h2.tools.SimpleResultSet;
-import org.h2.value.Value;
-import org.h2.value.ValueArray;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
@@ -260,21 +258,25 @@ public class CSVPrinterTest {
@Test
public void testCloseWithFlushOff() throws IOException {
- final Writer writer = mock(Writer.class);
- final CSVFormat csvFormat = CSVFormat.DEFAULT;
- final CSVPrinter csvPrinter = new CSVPrinter(writer, csvFormat);
- csvPrinter.close(false);
- verify(writer, never()).flush();
- verify(writer, times(1)).close();
+ try (final Writer writer = mock(Writer.class)) {
+ final CSVFormat csvFormat = CSVFormat.DEFAULT;
+ @SuppressWarnings("resource")
+ final CSVPrinter csvPrinter = new CSVPrinter(writer, csvFormat);
+ csvPrinter.close(false);
+ verify(writer, never()).flush();
+ verify(writer, times(1)).close();
+ }
}
@Test
public void testCloseWithFlushOn() throws IOException {
- final Writer writer = mock(Writer.class);
- final CSVFormat csvFormat = CSVFormat.DEFAULT;
- final CSVPrinter csvPrinter = new CSVPrinter(writer, csvFormat);
- csvPrinter.close(true);
- verify(writer, times(1)).flush();
+ try (final Writer writer = mock(Writer.class)) {
+ final CSVFormat csvFormat = CSVFormat.DEFAULT;
+ @SuppressWarnings("resource")
+ final CSVPrinter csvPrinter = new CSVPrinter(writer, csvFormat);
+ csvPrinter.close(true);
+ verify(writer, times(1)).flush();
+ }
}
@Test