changeset 885:64dbae6be412

VarsExtractorResolverTest
author Devel 1
date Fri, 23 Mar 2018 12:17:49 +0100
parents f78b47850aa8
children ea6918227f40
files stress-tester/src/test/java/com/passus/st/vars/VarsExtractorResolverTest.java
diffstat 1 files changed, 34 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stress-tester/src/test/java/com/passus/st/vars/VarsExtractorResolverTest.java	Fri Mar 23 12:17:49 2018 +0100
@@ -0,0 +1,34 @@
+package com.passus.st.vars;
+
+import static com.passus.commons.collection.FluentBuilder.e;
+import static com.passus.commons.collection.FluentBuilder.map;
+import com.passus.filter.UnmutableValueExtractor;
+import com.passus.filter.ValueExtractor;
+import static com.passus.st.client.http.filter.HttpVarsFilterTest.val;
+import java.util.Map;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * @author mikolaj.podbielski
+ */
+public class VarsExtractorResolverTest {
+
+    private final Map<String, ValueExtractor> appVars = map(
+            e("var1", val("value1")),
+            e("name", val("X")),
+            e("type", val("x"))
+    );
+
+    private final VarsExtractorResolver resolver = new VarsExtractorResolver(appVars);
+
+    @Test
+    public void testResolveValueExtractor() {
+        ValueExtractor result = resolver.resolveValueExtractor("appVars.var1");
+        assertTrue(result instanceof UnmutableValueExtractor);
+        UnmutableValueExtractor uve = (UnmutableValueExtractor) result;
+        assertEquals(uve.getValue(), "value1");
+    }
+
+}