Search in sources :

Example 21 with SimpleScalar

use of freemarker.template.SimpleScalar in project android by JetBrains.

the class FmEscapeXmlAttributeMethodTest method check.

@SuppressWarnings("rawtypes")
private void check(String s, String expected) throws TemplateModelException {
    FmEscapeXmlAttributeMethod method = new FmEscapeXmlAttributeMethod();
    List list = Collections.singletonList(new SimpleScalar(s));
    assertEquals(expected, ((SimpleScalar) method.exec(list)).getAsString());
}
Also used : List(java.util.List) SimpleScalar(freemarker.template.SimpleScalar)

Example 22 with SimpleScalar

use of freemarker.template.SimpleScalar in project android by JetBrains.

the class FmEscapeXmlStringMethodTest method check.

@SuppressWarnings("rawtypes")
private void check(String s, String expected) throws TemplateModelException {
    FmEscapeXmlStringMethod method = new FmEscapeXmlStringMethod();
    List list = Collections.singletonList(new SimpleScalar(s));
    assertEquals(expected, ((SimpleScalar) method.exec(list)).getAsString());
}
Also used : List(java.util.List) SimpleScalar(freemarker.template.SimpleScalar)

Example 23 with SimpleScalar

use of freemarker.template.SimpleScalar in project android by JetBrains.

the class FmTruncateStringMethodTest method check.

@SuppressWarnings("rawtypes")
private static void check(String s, int max, String expected) throws TemplateModelException {
    FmTruncateStringMethod method = new FmTruncateStringMethod();
    List list = Arrays.asList(new SimpleScalar(s), new SimpleNumber(max));
    assertEquals(expected, ((SimpleScalar) method.exec(list)).getAsString());
}
Also used : SimpleNumber(freemarker.template.SimpleNumber) List(java.util.List) SimpleScalar(freemarker.template.SimpleScalar)

Aggregations

SimpleScalar (freemarker.template.SimpleScalar)23 List (java.util.List)17 SimpleNumber (freemarker.template.SimpleNumber)5 ArrayList (java.util.ArrayList)5 TemplateModel (freemarker.template.TemplateModel)4 Result (ninja.Result)4 Test (org.junit.Test)4 TemplateModelException (freemarker.template.TemplateModelException)3 StringModel (freemarker.ext.beans.StringModel)2 SimpleDate (freemarker.template.SimpleDate)2 ContainerUtil.newArrayList (com.intellij.util.containers.ContainerUtil.newArrayList)1 Template (freemarker.template.Template)1 Date (java.util.Date)1 ConstraintViolation (ninja.validation.ConstraintViolation)1