Introduced AbstractMojoTestCase#addGuiceModules to allow guice injector customization
git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-testing/trunk@1543045 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/AbstractMojoTestCase.java b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/AbstractMojoTestCase.java
index 4369398..08cd9aa 100644
--- a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/AbstractMojoTestCase.java
+++ b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/AbstractMojoTestCase.java
@@ -26,8 +26,10 @@
import java.io.Reader;
import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Field;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import org.apache.commons.io.input.XmlStreamReader;
@@ -50,7 +52,6 @@
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.project.MavenProject;
import org.apache.maven.repository.RepositorySystem;
-import org.apache.maven.repository.internal.MavenAetherModule;
import org.apache.maven.repository.internal.MavenRepositorySystemUtils;
import org.codehaus.plexus.ContainerConfiguration;
import org.codehaus.plexus.DefaultContainerConfiguration;
@@ -74,6 +75,8 @@
import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.codehaus.plexus.util.xml.Xpp3DomBuilder;
+import com.google.inject.Module;
+
/**
* TODO: add a way to use the plugin POM for the lookup so that the user doesn't have to provide the a:g:v:goal
* as the role hint for the mojo lookup.
@@ -158,7 +161,9 @@
ContainerConfiguration cc = setupContainerConfiguration();
try
{
- container = new DefaultPlexusContainer( cc );
+ List<Module> modules = new ArrayList<Module>();
+ addGuiceModules( modules );
+ container = new DefaultPlexusContainer( cc, modules.toArray( new Module[modules.size()] ) );
}
catch ( PlexusContainerException e )
{
@@ -167,6 +172,14 @@
}
}
+ /**
+ * @since 3.0.0
+ */
+ protected void addGuiceModules( List<Module> modules )
+ {
+ // no custom guice modules by default
+ }
+
protected ContainerConfiguration setupContainerConfiguration()
{
ClassWorld classWorld = new ClassWorld( "plexus.core", Thread.currentThread().getContextClassLoader() );