use of org.summerb.stringtemplate.api.StringTemplateCompiler in project summerb by skarpushin.
the class StringTemplateValidationUtilsTest method testValidateStringTemplate_blackbox_expectOkForValidExpression.
@Test
public void testValidateStringTemplate_blackbox_expectOkForValidExpression() throws Exception {
StringTemplateCompiler stringTemplateCompiler = new StringTemplateCompilerlImpl();
String stringTemplate = "Constant text plus ${vars['4444']}";
ValidationContext ctx = new ValidationContext();
String fieldToken = "fieldToken";
StringTemplateValidationUtils.validateStringTemplate(stringTemplateCompiler, stringTemplate, ctx, fieldToken);
assertEquals(false, ctx.getHasErrors());
}
use of org.summerb.stringtemplate.api.StringTemplateCompiler in project summerb by skarpushin.
the class StringTemplateValidationUtilsTest method testValidateStringTemplate_blackbox_expectValidationErrorForWrongExpression.
@Test
public void testValidateStringTemplate_blackbox_expectValidationErrorForWrongExpression() throws Exception {
StringTemplateCompiler stringTemplateCompiler = new StringTemplateCompilerlImpl();
String stringTemplate = "Constant text plus ${vars['4444";
ValidationContext ctx = new ValidationContext();
String fieldToken = "fieldToken";
StringTemplateValidationUtils.validateStringTemplate(stringTemplateCompiler, stringTemplate, ctx, fieldToken);
assertEquals(true, ctx.getHasErrors());
}
use of org.summerb.stringtemplate.api.StringTemplateCompiler in project summerb by skarpushin.
the class StringTemplateValidationUtilsTest method testValidateStringTemplate_blackbox_expectOkForConstant.
@Test
public void testValidateStringTemplate_blackbox_expectOkForConstant() throws Exception {
StringTemplateCompiler stringTemplateCompiler = new StringTemplateCompilerlImpl();
String stringTemplate = "Constant text";
ValidationContext ctx = new ValidationContext();
String fieldToken = "fieldToken";
StringTemplateValidationUtils.validateStringTemplate(stringTemplateCompiler, stringTemplate, ctx, fieldToken);
assertEquals(false, ctx.getHasErrors());
}
Aggregations