use of javax.servlet.jsp.JspException in project sonarqube by SonarSource.
the class TestTagUtils method testComputeParameters2a.
// Provided map -- name
public void testComputeParameters2a() {
Map map = new HashMap();
map.put("foo1", "bar1");
map.put("foo2", "bar2");
request.getSession().setAttribute("attr", map);
try {
map = tagutils.computeParameters(pageContext, null, null, null, null, "attr", null, null, false);
} catch (JspException e) {
fail("JspException: " + e);
}
assertNotNull("Map is not null", map);
assertEquals("Two parameter in the returned map", 2, map.size());
assertTrue("Parameter foo1 present", map.containsKey("foo1"));
assertEquals("Parameter foo1 value", "bar1", (String) map.get("foo1"));
assertTrue("Parameter foo2 present", map.containsKey("foo2"));
assertEquals("Parameter foo2 value", "bar2", (String) map.get("foo2"));
}
use of javax.servlet.jsp.JspException in project sonarqube by SonarSource.
the class TestTagUtils method testComputeParameters2b.
// Provided map -- scope + name
public void testComputeParameters2b() {
Map map = new HashMap();
map.put("foo1", "bar1");
map.put("foo2", "bar2");
request.setAttribute("attr", map);
try {
map = tagutils.computeParameters(pageContext, null, null, null, null, "attr", null, "request", false);
} catch (JspException e) {
fail("JspException: " + e);
}
assertNotNull("Map is not null", map);
assertEquals("Two parameter in the returned map", 2, map.size());
assertTrue("Parameter foo1 present", map.containsKey("foo1"));
assertEquals("Parameter foo1 value", "bar1", (String) map.get("foo1"));
assertTrue("Parameter foo2 present", map.containsKey("foo2"));
assertEquals("Parameter foo2 value", "bar2", (String) map.get("foo2"));
}
use of javax.servlet.jsp.JspException in project sonarqube by SonarSource.
the class TestTagUtils method test_Object_lookup_PageContext_String__String2.
// lookup with page scope
public void test_Object_lookup_PageContext_String__String2() {
pageContext.setAttribute("bean", new MockFormBean());
try {
Object val = tagutils.lookup(pageContext, "bean", "page");
assertNotNull((val));
} catch (JspException e) {
fail("bean not found:" + e.getMessage());
}
}
use of javax.servlet.jsp.JspException in project sonarqube by SonarSource.
the class TestTagUtils method testComputeParametersPropertyThrowsException.
// accessing this property causes an exception
public void testComputeParametersPropertyThrowsException() {
request.getSession().setAttribute("SomeBean", new MockFormBean(true));
Map map = null;
try {
map = tagutils.computeParameters(pageContext, null, null, null, null, "SomeBean", "justThrowAnException", null, false);
fail("JspException not thrown");
} catch (JspException e) {
assertNull("map is null", map);
}
}
use of javax.servlet.jsp.JspException in project jodd by oblac.
the class CaseTag method doTag.
@Override
public void doTag() throws JspException {
JspTag parent = getParent();
if (!(parent instanceof SwitchTag)) {
throw new JspException(SwitchTag.MSG_PARENT_SWITCH_REQUIRED, null);
}
SwitchTag switchTag = (SwitchTag) parent;
if ((switchTag.getValue() != null) && switchTag.getValue().equals(value)) {
switchTag.valueFounded();
TagUtil.invokeBody(getJspBody());
}
}
Aggregations