1 18 19 package org.apache.strutsel.taglib.logic; 20 21 import javax.servlet.ServletException ; 22 import javax.servlet.jsp.JspException ; 23 import javax.servlet.jsp.tagext.Tag ; 24 import junit.framework.Test; 25 import junit.framework.TestSuite; 26 27 import org.apache.cactus.JspTestCase; 28 import org.apache.cactus.WebRequest; 29 import org.apache.strutsel.taglib.utils.TestFormBean; 30 31 public class TestELNotMatchTag 32 extends JspTestCase { 33 34 protected final static String PROP_KEY = "stringProperty"; 35 protected final static String VAR_KEY = "stringVar"; 36 protected final static String VALUE_KEY = "abcde"; 37 protected final static String PREFIX_VALUE_KEY = "abc"; 38 protected final static String BAD_VALUE_KEY = "abx"; 39 protected ELNotMatchTag elNotMatchTag = null; 40 41 public TestELNotMatchTag(String theName) { 42 super(theName); 43 } 44 45 public static void main(String [] args) { 46 junit.awtui.TestRunner.main( 47 new String [] { TestELNotMatchTag.class.getName() }); 48 } 49 50 public static Test suite() { 51 52 return new TestSuite(TestELNotMatchTag.class); 53 } 54 55 public void setUp() { 56 elNotMatchTag = new ELNotMatchTag(); 57 elNotMatchTag.setPageContext(pageContext); 58 } 59 60 public void tearDown() { 61 elNotMatchTag = null; 62 } 63 64 public void beginMatchStringMatches(WebRequest testRequest) { 65 } 66 67 public void testMatchStringMatches() 68 throws ServletException , JspException { 69 TestFormBean formBean = new TestFormBean(); 70 formBean.setStringProperty(VALUE_KEY); 71 pageContext.setAttribute("testFormBean", formBean); 72 73 pageContext.setAttribute(VAR_KEY, VALUE_KEY); 74 75 elNotMatchTag.setNameExpr("testFormBean"); 76 elNotMatchTag.setPropertyExpr(PROP_KEY); 77 78 elNotMatchTag.setValueExpr(VALUE_KEY); 79 80 int startTagReturn = elNotMatchTag.doStartTag(); 81 assertEquals("Match string matches comparison", false, 82 startTagReturn == Tag.EVAL_BODY_INCLUDE); 83 } 84 85 92 97 104 } 109 | Popular Tags |