use of javax.servlet.jsp.JspException in project sonarqube by SonarSource.
the class TestTagUtils method testComputeParametersParamIdParamPropThrowException.
public void testComputeParametersParamIdParamPropThrowException() {
request.getSession().setAttribute("SomeBean", new MockFormBean(true));
Map map = null;
try {
map = tagutils.computeParameters(pageContext, "paramId", "SomeBean", "justThrowAnException", null, null, null, null, false);
fail("JspException not thrown");
} catch (JspException e) {
assertNull("map is null", map);
}
}
use of javax.servlet.jsp.JspException in project sonarqube by SonarSource.
the class TestTagUtils method testComputeParameters0a.
// ---------------------------------------------------- computeParameters()
// No parameters and no transaction token
public void testComputeParameters0a() {
Map map = null;
try {
map = tagutils.computeParameters(pageContext, null, null, null, null, null, null, null, false);
} catch (JspException e) {
fail("JspException: " + e);
}
assertNull("Map is null", map);
}
use of javax.servlet.jsp.JspException in project sonarqube by SonarSource.
the class TestTagUtils method testComputeParametersBeanNotFound.
// specified bean is not found
public void testComputeParametersBeanNotFound() {
Map map = null;
try {
map = tagutils.computeParameters(pageContext, null, null, null, null, "i-do-not-exist", null, null, false);
fail("JspException not thrown");
} catch (JspException e) {
assertNull("map is null", map);
}
}
use of javax.servlet.jsp.JspException in project sonarqube by SonarSource.
the class TestTagUtils method testComputeParameters1c.
// Single parameter -- scope + name + property
public void testComputeParameters1c() {
request.setAttribute("attr", new MockFormBean("bar"));
Map map = null;
try {
map = tagutils.computeParameters(pageContext, "foo", "attr", "stringProperty", "request", null, null, null, false);
} catch (JspException e) {
fail("JspException: " + e);
}
assertNotNull("Map is not null", map);
assertEquals("One parameter in the returned map", 1, map.size());
assertTrue("Parameter present", map.containsKey("foo"));
assertEquals("Parameter value", "bar", (String) map.get("foo"));
}
use of javax.servlet.jsp.JspException in project sonarqube by SonarSource.
the class TestTagUtils method testComputeParameters2c.
// Provided map -- scope + name + property
public void testComputeParameters2c() {
request.setAttribute("attr", new MockFormBean());
Map map = null;
try {
map = tagutils.computeParameters(pageContext, null, null, null, null, "attr", "mapProperty", "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"));
}
Aggregations