下面列出了javax.servlet.jsp.JspException#getMessage ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Test
public void withInvalidList() throws Exception {
this.tag.setPath("country");
this.tag.setItems(new TestBean());
this.tag.setItemValue("isoCode");
try {
this.tag.doStartTag();
fail("Must not be able to use a non-Collection typed value as the value of 'items'");
}
catch (JspException expected) {
String message = expected.getMessage();
assertTrue(message.contains("items"));
assertTrue(message.contains("org.springframework.tests.sample.beans.TestBean"));
}
}
@Test
public void withInvalidList() throws Exception {
this.tag.setPath("country");
this.tag.setItems(new TestBean());
this.tag.setItemValue("isoCode");
try {
this.tag.doStartTag();
fail("Must not be able to use a non-Collection typed value as the value of 'items'");
}
catch (JspException expected) {
String message = expected.getMessage();
assertTrue(message.contains("items"));
assertTrue(message.contains("org.springframework.tests.sample.beans.TestBean"));
}
}
public static String dump(Node n) {
try {
DumpVisitor dv = new DumpVisitor();
n.accept(dv);
return dv.getString();
} catch (JspException e) {
LOGGER.log(Level.INFO, null, e);
return e.getMessage();
}
}
public static String dump(Node.Nodes page) {
try {
DumpVisitor dv = new DumpVisitor();
page.visit(dv);
return dv.getString();
} catch (JspException e) {
LOGGER.log(Level.INFO, null, e);
return e.getMessage();
}
}
@Test
public void withInvalidList() throws Exception {
this.tag.setPath("country");
this.tag.setItems(new TestBean());
this.tag.setItemValue("isoCode");
try {
this.tag.doStartTag();
fail("Must not be able to use a non-Collection typed value as the value of 'items'");
}
catch (JspException expected) {
String message = expected.getMessage();
assertTrue(message.contains("items"));
assertTrue(message.contains("org.springframework.tests.sample.beans.TestBean"));
}
}