changeset 737:c9027685888e

VarsExecutor bugfix
author Devel 2
date Tue, 05 Dec 2017 11:08:43 +0100
parents 967ac5f48f58
children 8e37b4b2d695
files stress-tester/src/main/java/com/passus/st/vars/VarsExecutor.java stress-tester/src/test/java/com/passus/st/vars/VarsExecutorTest.java
diffstat 2 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/vars/VarsExecutor.java	Tue Dec 05 11:07:07 2017 +0100
+++ b/stress-tester/src/main/java/com/passus/st/vars/VarsExecutor.java	Tue Dec 05 11:08:43 2017 +0100
@@ -20,11 +20,11 @@
     }
 
     public boolean execute(byte[] data, int startOffer, int endOffset, ByteBuff result, List<Var> vars, Object context) {
-        boolean processed = false;
         if (vars == null || vars.isEmpty()) {
-            return processed;
+            return false;
         }
 
+        boolean processed = false;
         int endIndex = endOffset - 1;
         int offset = 0;
         for (Var var : vars) {
--- a/stress-tester/src/test/java/com/passus/st/vars/VarsExecutorTest.java	Tue Dec 05 11:07:07 2017 +0100
+++ b/stress-tester/src/test/java/com/passus/st/vars/VarsExecutorTest.java	Tue Dec 05 11:08:43 2017 +0100
@@ -2,8 +2,6 @@
 
 import com.passus.data.ByteBuff;
 import com.passus.data.HeapByteBuff;
-import com.passus.st.client.http.filter.HttpMessageWrapper;
-import com.passus.st.filter.HttpMessageFieldExtractorFactory;
 import java.util.List;
 import static org.testng.AssertJUnit.assertEquals;
 import org.testng.annotations.AfterMethod;
@@ -31,7 +29,8 @@
             {"a ${var1} ${bad@var%name}", true, "a abcdef ${bad@var%name}"},
             {"${var1}g", true, "abcdefg"},
             {"${var", false, null},
-            {"${unresolvable}", false, null}
+            {"${unresolvable}", false, null},
+            {"", false, null}
         };
     }