1 16 package org.apache.cocoon.selection; 17 18 import junit.framework.Test; 19 import junit.framework.TestSuite; 20 import junit.textui.TestRunner; 21 import org.apache.avalon.framework.parameters.Parameters; 22 import org.apache.cocoon.SitemapComponentTestCase; 23 24 25 public class RequestMethodSelectorTestCase extends SitemapComponentTestCase { 26 27 32 public static void main( String [] args ) { 33 TestRunner.run(suite()); 34 } 35 36 40 public static Test suite() { 41 TestSuite suite = new TestSuite(RequestMethodSelectorTestCase.class); 42 return suite; 43 } 44 45 48 public void testRequestMethodSelect() throws Exception { 49 final String method = "POST"; 50 getRequest().setMethod( "POST" ); 51 52 Parameters parameters = new Parameters(); 53 boolean result; 54 55 result = this.select( "request-method", method, parameters ); 57 System.out.println( result ); 58 assertTrue( "Test if a method is selected", result ); 59 60 result = this.select( "request-method", "post", parameters ); 62 System.out.println( result ); 63 assertTrue( "Test if a method is not selected", !result ); 64 65 result = this.select( "request-method", "GET", parameters ); 67 System.out.println( result ); 68 assertTrue( "Test if a method is not selected", !result ); 69 } 70 71 } 72 | Popular Tags |