use of org.apache.maven.plugin.Mojo in project maven-plugins by apache.
the class CheckstyleViolationCheckMojoTest method testNoOutputFile.
public void testNoOutputFile() throws Exception {
File pluginXmlFile = new File(getBasedir(), "src/test/plugin-configs/check-plugin-config.xml");
Mojo mojo = lookupMojo("check", pluginXmlFile);
assertNotNull("Mojo found.", mojo);
mojoSetup(mojo);
setVariableValueToObject(mojo, "outputFile", new File("target/NoSuchFile.xml"));
mojo.execute();
}
use of org.apache.maven.plugin.Mojo in project maven-plugins by apache.
the class TestSkip method doConfigTest.
private void doConfigTest(String mojoName, String configFile) throws Exception {
File testPom = new File(getBasedir(), "target/test-classes/unit/skip-test/" + configFile);
Mojo mojo = lookupMojo(mojoName, testPom);
assertNotNull(mojo);
CapturingLog log = new CapturingLog();
mojo.setLog(log);
mojo.execute();
assertTrue(log.getContent().contains("Skipping plugin execution"));
}
use of org.apache.maven.plugin.Mojo in project maven-plugins by apache.
the class CheckstyleViolationCheckMojoTest method testInvalidFormatWithSkipExec.
public void testInvalidFormatWithSkipExec() throws Exception {
File pluginXmlFile = new File(getBasedir(), "src/test/plugin-configs/check-plugin-config.xml");
Mojo mojo = lookupMojo("check", pluginXmlFile);
assertNotNull("Mojo found.", mojo);
mojoSetup(mojo);
setVariableValueToObject(mojo, "outputFileFormat", "plain");
try {
mojo.execute();
fail("Must throw an exception invalid format: plain");
} catch (MojoExecutionException e) {
//expected
}
}
use of org.apache.maven.plugin.Mojo in project maven-plugins by apache.
the class CheckstyleViolationCheckMojoTest method doTestPlainOutputFile.
private void doTestPlainOutputFile(boolean failsOnError) throws Exception {
File pluginXmlFile = new File(getBasedir(), "src/test/plugin-configs/check-plugin-plain-output.xml");
Mojo mojo = lookupMojo("check", pluginXmlFile);
assertNotNull("Mojo found.", mojo);
PluginDescriptor descriptorStub = new PluginDescriptor();
descriptorStub.setGroupId("org.apache.maven.plugins");
descriptorStub.setArtifactId("maven-checkstyle-plugin");
setVariableValueToObject(mojo, "plugin", descriptorStub);
setVariableValueToObject(mojo, "failsOnError", failsOnError);
mojo.execute();
}
use of org.apache.maven.plugin.Mojo in project maven-plugins by apache.
the class CheckstyleViolationCheckMojoTest method testNoFail.
public void testNoFail() throws Exception {
File pluginXmlFile = new File(getBasedir(), "src/test/plugin-configs/check-plugin-config.xml");
Mojo mojo = lookupMojo("check", pluginXmlFile);
assertNotNull("Mojo found.", mojo);
mojoSetup(mojo);
setVariableValueToObject(mojo, "failOnViolation", Boolean.FALSE);
mojo.execute();
}
Aggregations