Author: fschumacher
Date: Mon Feb 12 16:13:56 2018
New Revision: 1824002

URL: http://svn.apache.org/viewvc?rev=1824002&view=rev
Log:
Use java 8 stream features to collect data

Part of #356 on Github. Based on contribution by Graham Russell (graham at 
ham1.co.uk)

Modified:
    
jmeter/trunk/src/components/org/apache/jmeter/assertions/ResponseAssertion.java

Modified: 
jmeter/trunk/src/components/org/apache/jmeter/assertions/ResponseAssertion.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/assertions/ResponseAssertion.java?rev=1824002&r1=1824001&r2=1824002&view=diff
==============================================================================
--- 
jmeter/trunk/src/components/org/apache/jmeter/assertions/ResponseAssertion.java 
(original)
+++ 
jmeter/trunk/src/components/org/apache/jmeter/assertions/ResponseAssertion.java 
Mon Feb 12 16:13:56 2018
@@ -22,6 +22,7 @@ import java.io.Serializable;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.stream.Collectors;
 
 import org.apache.commons.lang3.StringUtils;
 import org.apache.jmeter.assertions.gui.AssertionGui;
@@ -364,14 +365,10 @@ public class ResponseAssertion extends A
                 }
             }
             if (orTest && !hasTrue){
-                StringBuilder errorMsg = new StringBuilder();
-                for(String tmp : allCheckMessage){
-                    errorMsg.append(tmp).append('\t');
-                }
                 result.setFailure(true);
                 String customMsg = getCustomFailureMessage();
                 if (StringUtils.isEmpty(customMsg)) {
-                    result.setFailureMessage(errorMsg.toString());
+                    
result.setFailureMessage(allCheckMessage.stream().collect(Collectors.joining("\t",
 "", "\t")));
                 } else {
                     result.setFailureMessage(customMsg);
                 }


Reply via email to