jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject svn commit: r1720246 - /jmeter/trunk/test/src/org/apache/jmeter/report/core/TestCsvSampleWriter.java
Date Tue, 15 Dec 2015 20:52:32 GMT
Author: fschumacher
Date: Tue Dec 15 20:52:32 2015
New Revision: 1720246

URL: http://svn.apache.org/viewvc?rev=1720246&view=rev
Log:
We can use flush on CsvSampleWriter instead of replacing the writer. Followup to r1720242

Modified:
    jmeter/trunk/test/src/org/apache/jmeter/report/core/TestCsvSampleWriter.java

Modified: jmeter/trunk/test/src/org/apache/jmeter/report/core/TestCsvSampleWriter.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/report/core/TestCsvSampleWriter.java?rev=1720246&r1=1720245&r2=1720246&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/report/core/TestCsvSampleWriter.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/report/core/TestCsvSampleWriter.java Tue Dec 15
20:52:32 2015
@@ -17,14 +17,13 @@
  */
 package org.apache.jmeter.report.core;
 
-import java.io.IOException;
 import java.io.StringWriter;
 import java.io.Writer;
 
-import org.apache.jmeter.util.JMeterUtils;
-
 import junit.framework.TestCase;
 
+import org.apache.jmeter.util.JMeterUtils;
+
 public class TestCsvSampleWriter extends TestCase {
 
     protected void setUp() throws Exception {
@@ -50,18 +49,11 @@ public class TestCsvSampleWriter extends
                 CsvSampleWriter csvWriter = new CsvSampleWriter(writer,
                         metadata)) {
             csvWriter.writeHeader();
-            // need to replace the writer to flush the original one
-            replaceWriter(csvWriter);
+            csvWriter.flush();
             assertEquals("a,b\n", writer.toString());
         }
     }
 
-    private void replaceWriter(CsvSampleWriter csvWriter) throws IOException {
-        try (Writer replacement = new StringWriter()) {
-            csvWriter.setWriter(replacement);
-        }
-    }
-
     public void testWriteWithoutWriter() throws Exception {
         try (CsvSampleWriter csvWriter = new CsvSampleWriter(metadata)) {
             Sample sample = new SampleBuilder(metadata).add("a1").add("b1")
@@ -95,8 +87,7 @@ public class TestCsvSampleWriter extends
             Sample sample = new SampleBuilder(metadata).add("a1").add("b1")
                     .build();
             csvWriter.write(sample);
-            // need to replace the writer to flush the original one
-            replaceWriter(csvWriter);
+            csvWriter.flush();
             assertEquals("a1,b1\n", writer.toString());
         }
     }



Mime
View raw message