@Test public void testWithoutResource() throws Exception { String template = "<%@ taglib prefix='res' uri='http://www.unidal.org/webres' %>" + // "<res:bean id='res'/>Hello, ${name}! Nice to meet ${you}!"; String expected = "Hello, world! Nice to meet robert!"; ITemplateRef ref = TemplateFactory.forRef().createInlineRef("/testWithoutResource.jsp", template); checkTemplate(ref, expected, "name", "world", "you", "robert"); }
@Test public void testWithResource() throws Exception { String template = "<%@ taglib prefix='res' uri='http://www.unidal.org/webres' %>" + // "<res:bean id='res'/>Hello, <res:img value='${res.img.shared.simple_svg}'/>!" + // "${res.img.local.eBayLogo_gif} and ${res.img.shared.eBayLogo_gif}!"; String expected = "Hello, <img src=\"/test/f/img/shared/simple.svg\" width=\"467\" height=\"462\">!" + // "/test/img/eBayLogo.gif and /test/f/img/shared/eBayLogo.gif!"; ITemplateRef ref = TemplateFactory.forRef().createInlineRef("/testWithResource1.jsp", template); checkTemplate(ref, expected); }
protected void checkTemplate(String source, String expected, Object... pairs) throws Exception { ITemplateRef templateRef = TemplateFactory.forRef().createInlineRef(source); checkTemplate(templateRef, expected, pairs); }