changeset 616:962b0184d05e

fixed bug exposed by passus-filter r
author Devel 1
date Thu, 12 Oct 2017 12:15:38 +0200
parents 6019422b29de
children f8118e01a91a
files stress-tester/src/test/java/com/passus/st/client/http/filter/HttpMessageWrapperTest.java
diffstat 1 files changed, 18 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester/src/test/java/com/passus/st/client/http/filter/HttpMessageWrapperTest.java	Tue Oct 10 12:28:09 2017 +0200
+++ b/stress-tester/src/test/java/com/passus/st/client/http/filter/HttpMessageWrapperTest.java	Thu Oct 12 12:15:38 2017 +0200
@@ -11,6 +11,7 @@
 import com.passus.net.http.HttpResponseBuilder;
 import com.passus.net.http.HttpStatus;
 import com.passus.net.http.URL;
+import com.passus.st.AppUtils;
 import com.passus.st.ParametersBag;
 import static com.passus.st.client.http.HttpConsts.TAG_SESSION_ID;
 import com.passus.st.client.http.HttpFlowContext;
@@ -18,6 +19,8 @@
 import java.text.ParseException;
 import java.util.HashMap;
 import static org.testng.AssertJUnit.*;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
 /**
@@ -43,6 +46,16 @@
     HttpMessageWrapper wrapper = new HttpMessageWrapper(req, resp, context);
     ValueExtractorParser parser = new ValueExtractorParser();
 
+    @BeforeClass
+    public static void beforeClass() {
+        AppUtils.registerAll();
+    }
+
+    @AfterClass
+    public static void afterClass() {
+        AppUtils.unregisterAll();
+    }
+
     @Test
     public void testUnmutableValueExtractor() throws ParseException {
         UnmutableValueExtractor e;
@@ -147,11 +160,12 @@
 
         e = mvel("$req.getVersion()");
         value = e.extract(wrapper);
-        assertEquals("HTTP/1.1", value);
+        assertEquals("HTTP/1.1", value.toString());
+        assertTrue(value instanceof ByteString);
 
         e = mvel("$req.version");
         value = e.extract(wrapper);
-        assertEquals("HTTP/1.1", value);
+        assertEquals("HTTP/1.1", value.toString());
 
 //        e = mvel("$req.url");
 //        value = e.extract(wrapper);
@@ -159,11 +173,11 @@
 
         e = mvel("$req.url.query");
         value = e.extract(wrapper);
-        assertEquals("action=delete", value);
+        assertEquals("action=delete", value.toString());
 
         e = mvel("$req.getHeader('User-Agent')");
         value = e.extract(wrapper);
-        assertEquals("stress-tester", value);
+        assertEquals("stress-tester", value.toString());
 
         e = mvel("$resp.status.code");
         value = e.extract(wrapper);