use of org.eclipse.jst.jsp.core.internal.java.jspel.ELGenerator in project webtools.sourceediting by eclipse.
the class JSPELTranslationTest method testBooleanMethods.
public void testBooleanMethods() throws ParseException {
final String content = "pageContext.request.secure";
final IStructuredModel model = StructuredModelManager.getModelManager().createUnManagedStructuredModelFor(ContentTypeIdForJSP.ContentTypeID_JSP);
final IStructuredDocument document = model.getStructuredDocument();
document.set("${" + content + "}");
final JSPELParser parser = JSPELParser.createParser(content);
ASTExpression expression = parser.Expression();
IStructuredDocumentRegion currentNode = document.getFirstStructuredDocumentRegion();
StringBuffer result = new StringBuffer();
new ELGenerator().generate(expression, currentNode, result, new HashMap(), document, currentNode, 0, content.length());
int index = result.indexOf("((HttpServletRequest)");
assertTrue("return of HTTPServletRequest was not found", index >= 0);
assertTrue("pageContext.request.secure is not using the boolean accessor", result.substring(index).startsWith("((HttpServletRequest)pageContext.getRequest()).isSecure()"));
}
Aggregations