@Test public void exceptionInSetupShouldBeConverted() throws Exception { new ReflectionHelper(echoMojo).setField("level", "Gurka"); expectedException.expect(MojoFailureException.class); expectedException.expectMessage(is("level must be either FAIL, ERROR, WARNING, INFO or DEBUG. Was: Gurka")); echoMojo.setup(); }
void setup() throws MojoFailureException { try { PluginParameters pluginParameters = new PluginParametersBuilder() .setMessage(message, fromFile) .setFile(basePath, toFile, append, force) .setLevel(level) .setFormatting(encoding, lineSeparator) .setDebug(characterOutput) .createPluginParameters(); echoPlugin = new EchoPlugin(mavenLogger, pluginParameters, echoOutput); } catch (FailureException fex) { new ExceptionHandler(fex).throwMojoFailureException(); } }
EchoMojo extends AbstractMojo { void setup() throws MojoFailureException { try { PluginParameters pluginParameters = new PluginParametersBuilder() .setMessage(message, fromFile) .setFile(basePath, toFile, append, force) .setLevel(level) .setFormatting(encoding, lineSeparator) .setDebug(characterOutput) .createPluginParameters(); echoPlugin = new EchoPlugin(mavenLogger, pluginParameters, echoOutput); } catch (FailureException fex) { new ExceptionHandler(fex).throwMojoFailureException(); } } }
EchoMojo extends AbstractMojo { void setup() throws MojoFailureException { try { PluginParameters pluginParameters = new PluginParametersBuilder() .setMessage(message, fromFile) .setFile(basePath, toFile, append, force) .setLevel(level) .setFormatting(encoding, lineSeparator) .setDebug(characterOutput) .createPluginParameters(); echoPlugin = new EchoPlugin(mavenLogger, pluginParameters, echoOutput); } catch (FailureException fex) { new ExceptionHandler(fex).throwMojoFailureException(); } }  }
EchoMojo extends AbstractMojo { void setup() throws MojoFailureException { try { PluginParameters pluginParameters = new PluginParametersBuilder() .setMessage(message, fromFile) .setFile(basePath, toFile, append, force) .setLevel(level) .setFormatting(encoding, lineSeparator) .setDebug(characterOutput) .createPluginParameters(); echoPlugin = new EchoPlugin(mavenLogger, pluginParameters, echoOutput); } catch (FailureException fex) { new ExceptionHandler(fex).throwMojoFailureException(); } }  @Override void execute(); }
EchoMojo extends AbstractMojo { void setup() throws MojoFailureException { try { PluginParameters pluginParameters = new PluginParametersBuilder() .setMessage(message, fromFile) .setFile(basePath, toFile, append, force) .setLevel(level) .setFormatting(encoding, lineSeparator) .setDebug(characterOutput) .createPluginParameters(); echoPlugin = new EchoPlugin(mavenLogger, pluginParameters, echoOutput); } catch (FailureException fex) { new ExceptionHandler(fex).throwMojoFailureException(); } }  @Override void execute();  }