public void bake(final JBakeConfiguration config) { final Oven oven = new Oven(config); oven.bake(); final List<Throwable> errors = oven.getErrors(); if (!errors.isEmpty()) { final StringBuilder msg = new StringBuilder(); // TODO: decide, if we want the all errors here msg.append( MessageFormat.format("JBake failed with {0} errors:\n", errors.size())); int errNr = 1; for (final Throwable error : errors) { msg.append(MessageFormat.format("{0}. {1}\n", errNr, error.getMessage())); ++errNr; } throw new JBakeException(msg.toString(), errors.get(0)); } } }
@Test public void bakeWithAbsolutePaths() { configuration.setTemplateFolder( new File(sourceFolder, "freemarkerTemplates") ); configuration.setContentFolder( new File(sourceFolder, "content") ); configuration.setAssetFolder( new File(sourceFolder, "assets") ); final Oven oven = new Oven(configuration); oven.bake(); assertThat(oven.getErrors()).isEmpty(); }
public void bake(final JBakeConfiguration config) { final Oven oven = new Oven(config); oven.bake(); final List<Throwable> errors = oven.getErrors(); if (!errors.isEmpty()) { final StringBuilder msg = new StringBuilder(); // TODO: decide, if we want the all errors here msg.append( MessageFormat.format("JBake failed with {0} errors:\n", errors.size())); int errNr = 1; for (final Throwable error : errors) { msg.append(MessageFormat.format("{0}. {1}\n", errNr, error.getMessage())); ++errNr; } throw new JBakeException(msg.toString(), errors.get(0)); } } }