You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by br...@apache.org on 2018/09/19 09:04:45 UTC

[28/48] commons-csv git commit: Fix compiler warning.

Fix compiler warning.

Project: http://git-wip-us.apache.org/repos/asf/commons-csv/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-csv/commit/33f662b2
Tree: http://git-wip-us.apache.org/repos/asf/commons-csv/tree/33f662b2
Diff: http://git-wip-us.apache.org/repos/asf/commons-csv/diff/33f662b2

Branch: refs/heads/release
Commit: 33f662b219b439af5134de4553a1bb9485136999
Parents: 5c0d27c
Author: Gary Gregory <ga...@gmail.com>
Authored: Fri May 18 13:47:37 2018 -0600
Committer: Gary Gregory <ga...@gmail.com>
Committed: Fri May 18 13:47:37 2018 -0600

----------------------------------------------------------------------
 .../org/apache/commons/csv/CSVPrinterTest.java  | 39 ++++++++++----------
 1 file changed, 20 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-csv/blob/33f662b2/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/csv/CSVPrinterTest.java b/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
index 36308c5..45c8445 100644
--- a/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
+++ b/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
@@ -1352,33 +1352,34 @@ public class CSVPrinterTest {
 
     @Test
     public void testCloseBackwardCompatibility() throws IOException {
-        final Writer writer = mock(Writer.class);
-        final CSVFormat csvFormat = CSVFormat.DEFAULT;
-        try (CSVPrinter csvPrinter = new CSVPrinter(writer, csvFormat)) {
-        }
-        verify(writer, never()).flush();
-        verify(writer, times(1)).close();
-    }
+        try (final Writer writer = mock(Writer.class)) {
+            final CSVFormat csvFormat = CSVFormat.DEFAULT;
+            try (CSVPrinter csvPrinter = new CSVPrinter(writer, csvFormat)) {
+            }
+            verify(writer, never()).flush();
+            verify(writer, times(1)).close();
+        }}
 
     @Test
     public void testCloseWithCsvFormatAutoFlushOn() throws IOException {
         // System.out.println("start method");
-        final Writer writer = mock(Writer.class);
-        final CSVFormat csvFormat = CSVFormat.DEFAULT.withAutoFlush(true);
-        try (CSVPrinter csvPrinter = new CSVPrinter(writer, csvFormat)) {
-        }
-        verify(writer, times(1)).flush();
-        verify(writer, times(1)).close();
-    }
+        try (final Writer writer = mock(Writer.class)) {
+            final CSVFormat csvFormat = CSVFormat.DEFAULT.withAutoFlush(true);
+            try (CSVPrinter csvPrinter = new CSVPrinter(writer, csvFormat)) {
+            }
+            verify(writer, times(1)).flush();
+            verify(writer, times(1)).close();
+        }}
 
     @Test
     public void testCloseWithCsvFormatAutoFlushOff() throws IOException {
-        final Writer writer = mock(Writer.class);
-        final CSVFormat csvFormat = CSVFormat.DEFAULT.withAutoFlush(false);
-        try (CSVPrinter csvPrinter = new CSVPrinter(writer, csvFormat)) {
+        try (final Writer writer = mock(Writer.class)) {
+            final CSVFormat csvFormat = CSVFormat.DEFAULT.withAutoFlush(false);
+            try (CSVPrinter csvPrinter = new CSVPrinter(writer, csvFormat)) {
+            }
+            verify(writer, never()).flush();
+            verify(writer, times(1)).close();
         }
-        verify(writer, never()).flush();
-        verify(writer, times(1)).close();
     }
 
 }