@Test public void testInvalidTemplateWrongSyntax() { String template = EMPTY_STRING + "At ${time}, ${name}" + NEW_LINE + "submitted the following message:" + NEW_LINE + "${text}"; assertThatThrownBy(() -> processor.preProcess(template)) .isInstanceOf(TemplateProcessingException.class) .hasMessageContaining("wrong language"); }
@SuppressWarnings("PMD.PrematureDeclaration") @Override public String preProcess(String template) throws TemplateProcessingException { String newTemplate = super.preProcess(template); if (inSectionSymbol) { throw new TemplateProcessingException("The template is invalid since a section has not been closed"); } newTemplate = newTemplate.replaceAll(DOUBLE_OPEN_BRACE_PATTERN, MUSTACHE_OPEN_DELIMITER); newTemplate = newTemplate.replaceAll(DOUBLE_CLOSE_BRACE_PATTERN, MUSTACHE_CLOSE_DELIMITER); return newTemplate; }
MustacheTemplatePreProcessor extends AbstractTemplatePreProcessor { @SuppressWarnings("PMD.PrematureDeclaration") @Override public String preProcess(String template) throws TemplateProcessingException { String newTemplate = super.preProcess(template); if (inSectionSymbol) { throw new TemplateProcessingException("The template is invalid since a section has not been closed"); } newTemplate = newTemplate.replaceAll(DOUBLE_OPEN_BRACE_PATTERN, MUSTACHE_OPEN_DELIMITER); newTemplate = newTemplate.replaceAll(DOUBLE_CLOSE_BRACE_PATTERN, MUSTACHE_CLOSE_DELIMITER); return newTemplate; } }
MustacheTemplatePreProcessor extends AbstractTemplatePreProcessor { @SuppressWarnings("PMD.PrematureDeclaration") @Override public String preProcess(String template) throws TemplateProcessingException { String newTemplate = super.preProcess(template); if (inSectionSymbol) { throw new TemplateProcessingException("The template is invalid since a section has not been closed"); } newTemplate = newTemplate.replaceAll(DOUBLE_OPEN_BRACE_PATTERN, MUSTACHE_OPEN_DELIMITER); newTemplate = newTemplate.replaceAll(DOUBLE_CLOSE_BRACE_PATTERN, MUSTACHE_CLOSE_DELIMITER); return newTemplate; } MustacheTemplatePreProcessor(); }
MustacheTemplatePreProcessor extends AbstractTemplatePreProcessor { @SuppressWarnings("PMD.PrematureDeclaration") @Override public String preProcess(String template) throws TemplateProcessingException { String newTemplate = super.preProcess(template); if (inSectionSymbol) { throw new TemplateProcessingException("The template is invalid since a section has not been closed"); } newTemplate = newTemplate.replaceAll(DOUBLE_OPEN_BRACE_PATTERN, MUSTACHE_OPEN_DELIMITER); newTemplate = newTemplate.replaceAll(DOUBLE_CLOSE_BRACE_PATTERN, MUSTACHE_CLOSE_DELIMITER); return newTemplate; } MustacheTemplatePreProcessor(); @SuppressWarnings("PMD.PrematureDeclaration") @Override String preProcess(String template); @Override boolean isMySymbol(String literal); @Override void reset(); @Override Map<String, Object> getUriParams(); }
MustacheTemplatePreProcessor extends AbstractTemplatePreProcessor { @SuppressWarnings("PMD.PrematureDeclaration") @Override public String preProcess(String template) throws TemplateProcessingException { String newTemplate = super.preProcess(template); if (inSectionSymbol) { throw new TemplateProcessingException("The template is invalid since a section has not been closed"); } newTemplate = newTemplate.replaceAll(DOUBLE_OPEN_BRACE_PATTERN, MUSTACHE_OPEN_DELIMITER); newTemplate = newTemplate.replaceAll(DOUBLE_CLOSE_BRACE_PATTERN, MUSTACHE_CLOSE_DELIMITER); return newTemplate; } MustacheTemplatePreProcessor(); @SuppressWarnings("PMD.PrematureDeclaration") @Override String preProcess(String template); @Override boolean isMySymbol(String literal); @Override void reset(); @Override Map<String, Object> getUriParams();  }