@Test(expected = CustomException.class) public void testClosureError() throws Exception { templateHelper.writeTemplate(new StringWriter(), template -> { throw new CustomException(); }); }
public void writeTemplate( Writer out, Consumer<StringTemplate> parameterSetter) throws TemplateException { Preconditions.checkNotNull(out); Preconditions.checkNotNull(parameterSetter); StringTemplate stringTemplate = group.getInstanceOf(templatePath); try { parameterSetter.accept(stringTemplate); stringTemplate.write(new AutoIndentWriter(out)); } catch (IOException e) { throw new TemplateException("Failed to write template: " + e, e); } }
StringTemplateHelper { public void writeTemplate( Writer out, Consumer<StringTemplate> parameterSetter) throws TemplateException { Preconditions.checkNotNull(out); Preconditions.checkNotNull(parameterSetter); StringTemplate stringTemplate = group.getInstanceOf(templatePath); try { parameterSetter.accept(stringTemplate); stringTemplate.write(new AutoIndentWriter(out)); } catch (IOException e) { throw new TemplateException("Failed to write template: " + e, e); } } }
StringTemplateHelper { public void writeTemplate( Writer out, Consumer<StringTemplate> parameterSetter) throws TemplateException { Preconditions.checkNotNull(out); Preconditions.checkNotNull(parameterSetter); StringTemplate stringTemplate = group.getInstanceOf(templatePath); try { parameterSetter.accept(stringTemplate); stringTemplate.write(new AutoIndentWriter(out)); } catch (IOException e) { throw new TemplateException("Failed to write template: " + e, e); } } StringTemplateHelper(
      Class<?> templateContextClass,
      String templateName,
      boolean cacheTemplates); }
StringTemplateHelper { public void writeTemplate( Writer out, Consumer<StringTemplate> parameterSetter) throws TemplateException { Preconditions.checkNotNull(out); Preconditions.checkNotNull(parameterSetter); StringTemplate stringTemplate = group.getInstanceOf(templatePath); try { parameterSetter.accept(stringTemplate); stringTemplate.write(new AutoIndentWriter(out)); } catch (IOException e) { throw new TemplateException("Failed to write template: " + e, e); } } StringTemplateHelper(
      Class<?> templateContextClass,
      String templateName,
      boolean cacheTemplates); void writeTemplate(
      Writer out,
      Consumer<StringTemplate> parameterSetter); }
StringTemplateHelper { public void writeTemplate( Writer out, Consumer<StringTemplate> parameterSetter) throws TemplateException { Preconditions.checkNotNull(out); Preconditions.checkNotNull(parameterSetter); StringTemplate stringTemplate = group.getInstanceOf(templatePath); try { parameterSetter.accept(stringTemplate); stringTemplate.write(new AutoIndentWriter(out)); } catch (IOException e) { throw new TemplateException("Failed to write template: " + e, e); } } StringTemplateHelper(
      Class<?> templateContextClass,
      String templateName,
      boolean cacheTemplates); void writeTemplate(
      Writer out,
      Consumer<StringTemplate> parameterSetter);  }