Author: pmouawad Date: Sat Dec 23 17:17:05 2017 New Revision: 1819170 URL: http://svn.apache.org/viewvc?rev=1819170&view=rev Log: Bug 61900 - Report Generator : Report generation fails if separator is a regex reserved char like '|' Improved SampleMetadataParserSpec Contributed by Graham Russell This closes #367 Bugzilla Id: 61900
Modified: jmeter/trunk/test/src/org/apache/jmeter/report/core/SampleMetadataParserSpec.groovy Modified: jmeter/trunk/test/src/org/apache/jmeter/report/core/SampleMetadataParserSpec.groovy URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/report/core/SampleMetadataParserSpec.groovy?rev=1819170&r1=1819169&r2=1819170&view=diff ============================================================================== --- jmeter/trunk/test/src/org/apache/jmeter/report/core/SampleMetadataParserSpec.groovy (original) +++ jmeter/trunk/test/src/org/apache/jmeter/report/core/SampleMetadataParserSpec.groovy Sat Dec 23 17:17:05 2017 @@ -15,29 +15,29 @@ * limitations under the License. */ -package org.apache.jmeter.report.core; +package org.apache.jmeter.report.core -import org.apache.jmeter.junit.spock.JMeterSpec; -import org.apache.jmeter.report.core.SampleMetaDataParser; +import spock.lang.Specification import spock.lang.Unroll -class SampleMetadataParserSpec extends JMeterSpec { +@Unroll +class SampleMetadataParserSpec extends Specification { - @Unroll - def "Parse headers (#headers) using separator (#separator) and get (#expectedNumberOfColumns)"() { + def "Parse headers (#headers) with separator (#separator) and get (#expectedColumns)"() { given: - def dataParser = new SampleMetaDataParser(separator); + def sut = new SampleMetaDataParser(separator as char) when: - def metadata = dataParser.parse(headers); + def columns = sut.parse(headers).columns then: - metadata.columns.size() == expectedNumberOfColumns; + columns == expectedColumns where: - separator | headers | expectedNumberOfColumns - ';' as char | "a;b;c;d;e" | 5 - '|' as char | "a|b|c|d|e" | 5 - '|' as char | "aa|bb|cc|dd|eef" | 5 - '&' as char | "a&b&c&d&e" | 5 - '\t' as char | "a b c d e" | 4 + separator | headers | expectedColumns + ';' | "a;b;c;d;e" | ["a", "b", "c", "d", "e"] + '|' | "a|b|c|d|e" | ["a", "b", "c", "d", "e"] + '|' | "aa|bb|cc|dd|eef" | ["aa", "bb", "cc", "dd", "eef"] + '&' | "a&b&c&d&e" | ["a", "b", "c", "d", "e"] + '\t' | "a\tb c\td\te" | ["a", "b c", "d", "e"] + ',' | "abcdef" | ["abcdef"] } }