public class MojoTestRule<P extends AbstractPlugin>
extends org.apache.maven.plugin.testing.MojoRule
Test) the following properties :
testDirectory : location where to find resources for the testpomFile : location of the pom file to use to build the mojomojo : the instanciated and initialized mojo| Modifier | Constructor and Description |
|---|---|
protected |
MojoTestRule(Class<?> testClass,
String goalName) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
after() |
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description) |
protected void |
before() |
protected P |
createMojo(File pomFile,
String goalName) |
P |
getMojo() |
File |
getPomFile() |
protected File |
getPomFile(File testDir,
String methodName)
Obtain the location of the pom file to use for next mojo test.
|
String |
getRelativePathFromBasedir(File f) |
protected File |
getTestDir(String methodName)
Obtain the location of the directory where to find resources for the next test.
|
File |
getTestDirectory() |
boolean |
initMojo(P mojo) |
static <P extends AbstractPlugin> |
newRule(Class<?> testClass,
String goalName) |
protected void |
setUpMojo(P mojo,
File pomFile)
Initialize the given mojo.
|
protected void |
tearDownMojo(P mojo) |
configureMojo, configureMojo, executeMojo, executeMojo, executeMojo, executeMojo, extractPluginConfiguration, extractPluginConfiguration, getContainer, getPluginDescriptorLocation, getPluginDescriptorPath, getPublicDescriptorStream, getVariablesAndValuesFromObject, getVariablesAndValuesFromObject, getVariableValueFromObject, lookup, lookupConfiguredMojo, lookupConfiguredMojo, lookupConfiguredMojo, lookupEmptyMojo, lookupEmptyMojo, lookupMojo, lookupMojo, lookupMojo, newMavenSession, newMojoExecution, readMavenProject, setupContainer, setupContainerConfiguration, setVariableValueToObjectpublic static <P extends AbstractPlugin> MojoTestRule<P> newRule(Class<?> testClass, String goalName)
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description)
apply in interface org.junit.rules.TestRuleapply in class org.apache.maven.plugin.testing.MojoRuleprotected void setUpMojo(P mojo, File pomFile) throws Exception
mojo - the instanciate mojopomFile - the pom file used to instanciate the mojoException - if any pbpublic boolean initMojo(P mojo)
protected void tearDownMojo(P mojo)
protected void before()
throws Throwable
before in class org.apache.maven.plugin.testing.MojoRuleThrowableprotected void after()
after in class org.apache.maven.plugin.testing.MojoRulepublic P getMojo()
public File getPomFile()
public File getTestDirectory()
protected File getTestDir(String methodName)
TestHelper.getTestBasedir().methodName - the method of the next test to executeprotected File getPomFile(File testDir, String methodName)
methodName+".xml" in the testDir.testDir - the location of resources for the next test (is the
result of the method getTestDir(String).methodName - the name of the next testCopyright © 2009–2015 CodeLutin. All rights reserved.