Search in sources :

Example 1 with TemplateSpec

use of org.thymeleaf.TemplateSpec in project thymeleaf-tests by thymeleaf.

the class TemplateResolverAttributesTest method testTemplateResolutionAttributes02.

@Test
public void testTemplateResolutionAttributes02() throws Exception {
    final AttributeTesterTemplateResolver templateResolver = new AttributeTesterTemplateResolver(EXPECTED_ATTRIBUTES2);
    final TemplateEngine templateEngine = new TemplateEngine();
    templateEngine.setTemplateResolver(templateResolver);
    final TemplateSpec templateSpec = new TemplateSpec("temp", EXPECTED_ATTRIBUTES2);
    final String output = templateEngine.process(templateSpec, new Context());
    Assert.assertTrue(templateResolver.tempCalled);
    Assert.assertTrue(templateResolver.fragCalled);
    Assert.assertEquals(EXPECTED_OUTPUT, output);
}
Also used : Context(org.thymeleaf.context.Context) TemplateEngine(org.thymeleaf.TemplateEngine) TemplateSpec(org.thymeleaf.TemplateSpec) Test(org.junit.Test)

Example 2 with TemplateSpec

use of org.thymeleaf.TemplateSpec in project thymeleaf-tests by thymeleaf.

the class TemplateResolverAttributesTest method testTemplateResolutionAttributes01.

@Test
public void testTemplateResolutionAttributes01() throws Exception {
    final AttributeTesterTemplateResolver templateResolver = new AttributeTesterTemplateResolver(EXPECTED_ATTRIBUTES1);
    final TemplateEngine templateEngine = new TemplateEngine();
    templateEngine.setTemplateResolver(templateResolver);
    final TemplateSpec templateSpec = new TemplateSpec("temp", EXPECTED_ATTRIBUTES1);
    final String output = templateEngine.process(templateSpec, new Context());
    Assert.assertTrue(templateResolver.tempCalled);
    Assert.assertTrue(templateResolver.fragCalled);
    Assert.assertEquals(EXPECTED_OUTPUT, output);
}
Also used : Context(org.thymeleaf.context.Context) TemplateEngine(org.thymeleaf.TemplateEngine) TemplateSpec(org.thymeleaf.TemplateSpec) Test(org.junit.Test)

Example 3 with TemplateSpec

use of org.thymeleaf.TemplateSpec in project thymeleaf-tests by thymeleaf.

the class TemplateResolverAttributesTest method testTemplateResolutionAttributes03.

@Test
public void testTemplateResolutionAttributes03() throws Exception {
    final AttributeTesterTemplateResolver templateResolver = new AttributeTesterTemplateResolver(EXPECTED_ATTRIBUTES3);
    final TemplateEngine templateEngine = new TemplateEngine();
    templateEngine.setTemplateResolver(templateResolver);
    final TemplateSpec templateSpec = new TemplateSpec("temp", EXPECTED_ATTRIBUTES3);
    final String output = templateEngine.process(templateSpec, new Context());
    Assert.assertTrue(templateResolver.tempCalled);
    Assert.assertTrue(templateResolver.fragCalled);
    Assert.assertEquals(EXPECTED_OUTPUT, output);
}
Also used : Context(org.thymeleaf.context.Context) TemplateEngine(org.thymeleaf.TemplateEngine) TemplateSpec(org.thymeleaf.TemplateSpec) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 TemplateEngine (org.thymeleaf.TemplateEngine)3 TemplateSpec (org.thymeleaf.TemplateSpec)3 Context (org.thymeleaf.context.Context)3