Search in sources :

Example 6 with SimpleScalar

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

the class FmCompareVersionsMethodTest method check.

@SuppressWarnings("rawtypes")
private void check(String lhs, String rhs, int expected) throws Exception {
    FmCompareVersionsMethod method = new FmCompareVersionsMethod();
    List list = newArrayList(new SimpleScalar(lhs), new SimpleScalar(rhs));
    Number result = ((SimpleNumber) method.exec(list)).getAsNumber();
    assertEquals(expected, Integer.signum(result.intValue()));
}
Also used : SimpleNumber(freemarker.template.SimpleNumber) SimpleNumber(freemarker.template.SimpleNumber) List(java.util.List) ContainerUtil.newArrayList(com.intellij.util.containers.ContainerUtil.newArrayList) SimpleScalar(freemarker.template.SimpleScalar)

Example 7 with SimpleScalar

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

the class FmHasDependencyMethodTest method check.

@SuppressWarnings("rawtypes")
private static void check(boolean expected, String s, Map<String, Object> paramMap) throws TemplateModelException {
    FmHasDependencyMethod method = new FmHasDependencyMethod(paramMap);
    List list = Collections.singletonList(new SimpleScalar(s));
    assertEquals(expected, ((TemplateBooleanModel) method.exec(list)).getAsBoolean());
}
Also used : SimpleScalar(freemarker.template.SimpleScalar)

Example 8 with SimpleScalar

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

the class FmLayoutToActivityMethodTest method check.

@SuppressWarnings("rawtypes")
private static void check(String s, String expected) throws TemplateModelException {
    FmLayoutToActivityMethod method = new FmLayoutToActivityMethod();
    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 9 with SimpleScalar

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

the class FmSlashedPackageNameMethodTest method check.

@SuppressWarnings("rawtypes")
private void check(String s, String expected) throws TemplateModelException {
    FmSlashedPackageNameMethod method = new FmSlashedPackageNameMethod();
    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 10 with SimpleScalar

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

the class FmEscapeXmlTextMethodTest method check.

@SuppressWarnings("rawtypes")
private void check(String s, String expected) throws TemplateModelException {
    FmEscapeXmlTextMethod method = new FmEscapeXmlTextMethod();
    List list = Collections.singletonList(new SimpleScalar(s));
    assertEquals(expected, ((SimpleScalar) method.exec(list)).getAsString());
}
Also used : 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