Author: sebb
Date: Thu May  3 15:31:52 2007
New Revision: 535000

URL: http://svn.apache.org/viewvc?view=rev&rev=535000
Log:
More test cases

Modified:
    
jakarta/jmeter/branches/rel-2-2/test/src/org/apache/jmeter/protocol/http/parser/TestHtmlParsingUtils.java

Modified: 
jakarta/jmeter/branches/rel-2-2/test/src/org/apache/jmeter/protocol/http/parser/TestHtmlParsingUtils.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/test/src/org/apache/jmeter/protocol/http/parser/TestHtmlParsingUtils.java?view=diff&rev=535000&r1=534999&r2=535000
==============================================================================
--- 
jakarta/jmeter/branches/rel-2-2/test/src/org/apache/jmeter/protocol/http/parser/TestHtmlParsingUtils.java
 (original)
+++ 
jakarta/jmeter/branches/rel-2-2/test/src/org/apache/jmeter/protocol/http/parser/TestHtmlParsingUtils.java
 Thu May  3 15:31:52 2007
@@ -20,6 +20,8 @@
 
 import org.apache.jmeter.config.Argument;
 import org.apache.jmeter.junit.JMeterTestCase;
+import org.apache.jmeter.protocol.http.sampler.HTTPNullSampler;
+import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase;
 
 // TODO: need more tests
 public final class TestHtmlParsingUtils extends JMeterTestCase {
@@ -52,5 +54,53 @@
                        arg = new Argument("test", "abcd");
                        argp = new Argument("test", "a.*e");
                        assertFalse(HtmlParsingUtils.isArgumentMatched(arg, 
argp));
+               }
+               
+               public void testIsAnchorMatched() throws Exception {
+                       HTTPSamplerBase target=new HTTPNullSampler();
+                       HTTPSamplerBase pattern=new HTTPNullSampler();
+
+                       assertTrue(HtmlParsingUtils.isAnchorMatched(target, 
pattern));
+
+                       target.setProtocol("http:");
+                       assertFalse(HtmlParsingUtils.isAnchorMatched(target, 
pattern));
+
+                       pattern.setProtocol(".*");
+                       assertTrue(HtmlParsingUtils.isAnchorMatched(target, 
pattern));
+                       
+                       target.setDomain("a.b.c");
+                       assertTrue(HtmlParsingUtils.isAnchorMatched(target, 
pattern));
+
+                       pattern.setDomain(".*");
+                       assertTrue(HtmlParsingUtils.isAnchorMatched(target, 
pattern));
+                       
+                       target.setPath("/abc");
+                       assertFalse(HtmlParsingUtils.isAnchorMatched(target, 
pattern));
+
+                       pattern.setPath(".*");
+                       assertTrue(HtmlParsingUtils.isAnchorMatched(target, 
pattern));
+                       
+                       target.addArgument("param2", "value2", "=");
+                       assertTrue(HtmlParsingUtils.isAnchorMatched(target, 
pattern));
+                       
+                       pattern.addArgument("param1", ".*", "=");
+                       assertFalse(HtmlParsingUtils.isAnchorMatched(target, 
pattern));
+                       
+                       target.addArgument("param1", "value1", "=");
+                       assertTrue(HtmlParsingUtils.isAnchorMatched(target, 
pattern));
+               }
+               
+               public void testisEqualOrMatches() throws Exception {
+                       
assertTrue(HtmlParsingUtils.isEqualOrMatches("http:","http:"));
+                       
assertFalse(HtmlParsingUtils.isEqualOrMatches("http:","htTp:"));
+                       
assertTrue(HtmlParsingUtils.isEqualOrMatches("http:","ht+p:"));
+                       
assertFalse(HtmlParsingUtils.isEqualOrMatches("ht+p:","http:"));
+               }
+
+               public void testisEqualOrMatchesCaseBlind() throws Exception {
+                       
assertTrue(HtmlParsingUtils.isEqualOrMatchesCaseBlind("http:","http:"));
+                       
assertTrue(HtmlParsingUtils.isEqualOrMatchesCaseBlind("http:","htTp:"));
+                       
assertTrue(HtmlParsingUtils.isEqualOrMatches("http:","ht+p:"));
+                       
assertFalse(HtmlParsingUtils.isEqualOrMatches("ht+p:","http:"));
                }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to