jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1812820 - /jmeter/trunk/test/src/org/apache/jmeter/extractor/TestBoundaryExtractor.java
Date Sat, 21 Oct 2017 12:14:18 GMT
Author: pmouawad
Date: Sat Oct 21 12:14:18 2017
New Revision: 1812820

URL: http://svn.apache.org/viewvc?rev=1812820&view=rev
Log:
Bug 60213 - Boundary based extractor
Increase coverage and find a bug
Bugzilla Id: 60213

Modified:
    jmeter/trunk/test/src/org/apache/jmeter/extractor/TestBoundaryExtractor.java

Modified: jmeter/trunk/test/src/org/apache/jmeter/extractor/TestBoundaryExtractor.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/extractor/TestBoundaryExtractor.java?rev=1812820&r1=1812819&r2=1812820&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/extractor/TestBoundaryExtractor.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/extractor/TestBoundaryExtractor.java Sat Oct 21
12:14:18 2017
@@ -61,6 +61,18 @@ public class TestBoundaryExtractor {
     }
     
     @Test
+    public void testMatchOnLeftOnly() throws Exception {
+        result.setResponseData("zazzd azd azd azd <t>value</t>azdazd <t>value2</t>azd
azd", null);
+        extractor.setLeftBoundary("<t>");
+        extractor.setRightBoundary("</t1>");
+        extractor.setMatchNumber(0);
+        extractor.setDefaultValue("default");
+        extractor.process();
+        assertEquals("default", vars.get("regVal"));
+    }
+
+    
+    @Test
     public void testStaleVariables() throws Exception {
         result.setResponseData("zazzd azd azd azd <t>value</t>azdazd <t>value2</t>azd
azd", null);
         extractor.setLeftBoundary("<t>");
@@ -173,6 +185,38 @@ public class TestBoundaryExtractor {
         assertEquals("", vars.get("regVal"));
     }
     
+    @Test(expected=IllegalArgumentException.class)
+    public void testIllegalArgumentException() throws Exception {
+        extractor.setLeftBoundary(null);
+        extractor.setRightBoundary(null);
+        extractor.setRefName(null);
+        extractor.setMatchNumber(1);
+        extractor.setDefaultEmptyValue(true);
+        extractor.process();
+        assertEquals("", vars.get("regVal"));
+    }
+    
+    @Test
+    public void testNoProcessing() throws Exception {
+        extractor.setLeftBoundary("<t>");
+        extractor.setRightBoundary("</t>");
+        extractor.setMatchNumber(1);
+        context.setPreviousResult(null);
+        extractor.setDefaultEmptyValue(true);
+        extractor.process();
+        assertNull(vars.get("regVal"));
+    }
+
+    @Test
+    public void testEmptyVariable() throws Exception {
+        extractor.setLeftBoundary("<t>");
+        extractor.setRightBoundary("</t>");
+        extractor.setMatchNumber(1);
+        extractor.setScopeVariable("contentvar");
+        extractor.process();
+        assertNull(vars.get("regVal"));
+    }
+    
     @Test
     public void testNotEmptyDefaultVariable() throws Exception {
         extractor.setLeftBoundary("<t1>");



Mime
View raw message