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/05/27 12:04:36 UTC
[commons-csv] branch master updated: Be quiet on the console.
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 3241e0c Be quiet on the console.
3241e0c is described below
commit 3241e0c7b26dc7e493a3e22a086bbc6a712750df
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon May 27 08:04:32 2019 -0400
Be quiet on the console.
---
.../java/org/apache/commons/csv/CSVPrinterTest.java | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/test/java/org/apache/commons/csv/CSVPrinterTest.java b/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
index 8966a4d..913b5ea 100644
--- a/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
+++ b/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
@@ -29,6 +29,7 @@ import static org.mockito.Mockito.verify;
import java.io.CharArrayWriter;
import java.io.File;
import java.io.IOException;
+import java.io.PrintStream;
import java.io.StringReader;
import java.io.StringWriter;
import java.io.Writer;
@@ -51,6 +52,7 @@ import java.util.Random;
import java.util.Vector;
import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.output.NullOutputStream;
import org.apache.commons.lang3.StringUtils;
import org.h2.tools.SimpleResultSet;
import org.junit.Assert;
@@ -1243,12 +1245,18 @@ public class CSVPrinterTest {
@Test
public void testPrintRecordsWithEmptyVector() throws IOException {
- try (CSVPrinter csvPrinter = CSVFormat.POSTGRESQL_TEXT.printer()) {
- final Vector<CSVFormatTest.EmptyEnum> vector = new Vector<>();
- final int expectedCapacity = 23;
- vector.setSize(expectedCapacity);
- csvPrinter.printRecords(vector);
- assertEquals(expectedCapacity, vector.capacity());
+ final PrintStream out = System.out;
+ try {
+ System.setOut(new PrintStream(NullOutputStream.NULL_OUTPUT_STREAM));
+ try (CSVPrinter csvPrinter = CSVFormat.POSTGRESQL_TEXT.printer()) {
+ final Vector<CSVFormatTest.EmptyEnum> vector = new Vector<>();
+ final int expectedCapacity = 23;
+ vector.setSize(expectedCapacity);
+ csvPrinter.printRecords(vector);
+ assertEquals(expectedCapacity, vector.capacity());
+ }
+ } finally {
+ System.setOut(out);
}
}