use of org.thymeleaf.resource.StringResource in project thymeleaf-tests by thymeleaf.
the class CloseElementTagTest method computeHtmlTag.
private static ICloseElementTag computeHtmlTag(final String input) {
final String templateName = "test";
final TagObtentionTemplateHandler handler = new TagObtentionTemplateHandler();
HTML_PARSER.parse(TEMPLATE_ENGINE_CONFIGURATION, TemplateMode.HTML, new StringResource(templateName, input), handler);
return handler.tag;
}
use of org.thymeleaf.resource.StringResource in project thymeleaf-tests by thymeleaf.
the class HtmlBlockSelectorMarkupHandlerTest method check.
private static void check(final HTMLTemplateParser parser, final IEngineConfiguration templateEngineContext, final String templateName, final String input, final String output, final String[] blockSelectors) throws Exception {
final StringWriter writer = new StringWriter();
final ITemplateHandler handler = new OutputTemplateHandler(writer);
handler.setProcessingContext(StandardProcessingContextFactory.build(TEMPLATE_ENGINE_CONFIGURATION, templateName, TemplateMode.HTML, new Context(Locale.US)));
parser.parse(templateEngineContext, TemplateMode.HTML, new StringResource(templateName, input), blockSelectors, handler);
assertEquals("Test failed for file: " + templateName, output, writer.toString());
}
use of org.thymeleaf.resource.StringResource in project thymeleaf-tests by thymeleaf.
the class BareHtmlEngineTest method check.
private static void check(final String input, final String output, final String[] blockSelectors) throws Exception {
final String templateName = "test";
final StringWriter writer = new StringWriter();
final ITemplateHandler handler = new OutputTemplateHandler(writer);
handler.setProcessingContext(new ProcessingContext(TEMPLATE_ENGINE_CONFIGURATION, templateName, TemplateMode.HTML, Locale.US, null));
if (blockSelectors != null) {
PARSER.parse(TEMPLATE_ENGINE_CONFIGURATION, TemplateMode.HTML, new StringResource(templateName, input), blockSelectors, handler);
} else {
PARSER.parse(TEMPLATE_ENGINE_CONFIGURATION, TemplateMode.HTML, new StringResource(templateName, input), handler);
}
Assert.assertEquals("Test failed for file: " + templateName, output, writer.toString());
}
use of org.thymeleaf.resource.StringResource in project thymeleaf-tests by thymeleaf.
the class CloseElementTagTest method computeXmlTag.
private static ICloseElementTag computeXmlTag(final String input) {
final String templateName = "test";
final TagObtentionTemplateHandler handler = new TagObtentionTemplateHandler();
XML_PARSER.parse(TEMPLATE_ENGINE_CONFIGURATION, TemplateMode.XML, new StringResource(templateName, input), handler);
return handler.tag;
}
use of org.thymeleaf.resource.StringResource in project thymeleaf-tests by thymeleaf.
the class ElementProcessorIteratorTest method computeXmlTag.
private static TagObtentionTemplateHandler computeXmlTag(final String input, final Set<IDialect> dialects) {
final String templateName = "test";
final TagObtentionTemplateHandler handler = new TagObtentionTemplateHandler();
final IEngineConfiguration templateEngineContext = TestTemplateEngineConfigurationBuilder.build(dialects);
XML_PARSER.parse(templateEngineContext, TemplateMode.XML, new StringResource(templateName, input), handler);
return handler;
}
Aggregations