@@ -52,9 +52,18 @@ public void testPrintScopedAttributeResult() throws Exception {
52
52
assertEquals (Tag .EVAL_BODY_INCLUDE , action );
53
53
action = tag .doEndTag ();
54
54
assertEquals (Tag .EVAL_PAGE , action );
55
- assertEquals ("foo" , ((MockHttpServletResponse )context .getResponse ()).getContentAsString ());
55
+ assertEquals ("foo" , ((MockHttpServletResponse ) context .getResponse ()).getContentAsString ());
56
56
}
57
-
57
+
58
+ public void testPrintNullAsEmptyString () throws Exception {
59
+ tag .setExpression ("bean.null" );
60
+ int action = tag .doStartTag ();
61
+ assertEquals (Tag .EVAL_BODY_INCLUDE , action );
62
+ action = tag .doEndTag ();
63
+ assertEquals (Tag .EVAL_PAGE , action );
64
+ assertEquals ("" , ((MockHttpServletResponse ) context .getResponse ()).getContentAsString ());
65
+ }
66
+
58
67
public void testPrintFormattedScopedAttributeResult () throws Exception {
59
68
tag .setExpression ("bean.formattable" );
60
69
int action = tag .doStartTag ();
@@ -63,15 +72,15 @@ public void testPrintFormattedScopedAttributeResult() throws Exception {
63
72
assertEquals (Tag .EVAL_PAGE , action );
64
73
assertEquals ("25%" , ((MockHttpServletResponse ) context .getResponse ()).getContentAsString ());
65
74
}
66
-
75
+
67
76
public void testPrintHtmlEscapedAttributeResult () throws Exception {
68
77
tag .setExpression ("bean.html()" );
69
78
tag .setHtmlEscape ("true" );
70
79
int action = tag .doStartTag ();
71
80
assertEquals (Tag .EVAL_BODY_INCLUDE , action );
72
81
action = tag .doEndTag ();
73
82
assertEquals (Tag .EVAL_PAGE , action );
74
- assertEquals ("<p>" , ((MockHttpServletResponse )context .getResponse ()).getContentAsString ());
83
+ assertEquals ("<p>" , ((MockHttpServletResponse ) context .getResponse ()).getContentAsString ());
75
84
}
76
85
77
86
public void testPrintJavaScriptEscapedAttributeResult () throws Exception {
@@ -133,10 +142,15 @@ public BigDecimal getFormattable() {
133
142
public String html () {
134
143
return "<p>" ;
135
144
}
145
+
136
146
public String getBean () {
137
147
return "not the bean object" ;
138
148
}
139
149
150
+ public Object getNull () {
151
+ return null ;
152
+ }
153
+
140
154
public String js () {
141
155
return "function foo() { alert(\" hi\" ) }" ;
142
156
}
0 commit comments