You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2018/03/03 19:27:48 UTC

[maven-artifact-transfer] branch MSHARED-680 updated (62d72f2 -> 28870da)

This is an automated email from the ASF dual-hosted git repository.

khmarbaise pushed a change to branch MSHARED-680
in repository https://gitbox.apache.org/repos/asf/maven-artifact-transfer.git.


 discard 62d72f2  [MSHARED-680] - Add null check for DependencyResolver/DependencyCollector/ProjectDeployer Interfaces
     new 28870da  [MSHARED-680] - Add null check for DependencyResolver/DependencyCollector/ProjectDeployer Interfaces

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (62d72f2)
            \
             N -- N -- N   refs/heads/MSHARED-680 (28870da)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../internal/DefaultDependencyResolver.java        |  51 ++++++++-
 .../internal/DefaultDependencyResolverTest.java    | 118 +++++++++++++++++++++
 2 files changed, 164 insertions(+), 5 deletions(-)
 create mode 100644 src/test/java/org/apache/maven/shared/dependencies/resolve/internal/DefaultDependencyResolverTest.java

-- 
To stop receiving notification emails like this one, please contact
khmarbaise@apache.org.

[maven-artifact-transfer] 01/01: [MSHARED-680] - Add null check for DependencyResolver/DependencyCollector/ProjectDeployer Interfaces

Posted by kh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

khmarbaise pushed a commit to branch MSHARED-680
in repository https://gitbox.apache.org/repos/asf/maven-artifact-transfer.git

commit 28870da2a46670ac85052d403ad107797bc06101
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Wed Feb 21 22:06:52 2018 +0100

    [MSHARED-680] - Add null check for DependencyResolver/DependencyCollector/ProjectDeployer Interfaces
---
 .gitignore                                         |   1 +
 .../dependencies/collect/DependencyCollector.java  |   6 ++
 .../internal/DefaultDependencyCollector.java       |  52 ++++++++-
 .../internal/DefaultDependencyResolver.java        |  51 ++++++++-
 .../shared/project/deploy/ProjectDeployer.java     |  10 +-
 .../deploy/internal/DefaultProjectDeployer.java    |  95 +++++++++--------
 .../shared/project/install/ProjectInstaller.java   |  14 +--
 .../install/internal/DefaultProjectInstaller.java  |   3 +-
 .../internal/DefaultArtifactDeployerTest.java      |  12 ++-
 .../internal/DefaultArtifactInstallerTest.java     |   3 +-
 .../internal/DefaultDependencyCollectorTest.java   | 115 ++++++++++++++++++++
 .../internal/DefaultDependencyResolverTest.java    | 118 +++++++++++++++++++++
 .../DefaultDependencyCoordinateTest.java           |   1 +
 .../internal/DefaultProjectDeployerTest.java       |  82 ++++++++++++++
 .../internal/DefaultProjectInstallerTest.java      |  27 ++---
 15 files changed, 505 insertions(+), 85 deletions(-)

diff --git a/.gitignore b/.gitignore
index d0d7222..3578f45 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,5 +12,6 @@ out/
 .DS_Store
 /bootstrap
 /dependencies.xml
+/dependency-reduced-pom.xml
 .java-version
 dependency-reduced-pom.xml
diff --git a/src/main/java/org/apache/maven/shared/dependencies/collect/DependencyCollector.java b/src/main/java/org/apache/maven/shared/dependencies/collect/DependencyCollector.java
index c7d6783..ce996ed 100644
--- a/src/main/java/org/apache/maven/shared/dependencies/collect/DependencyCollector.java
+++ b/src/main/java/org/apache/maven/shared/dependencies/collect/DependencyCollector.java
@@ -40,6 +40,8 @@ public interface DependencyCollector
      * @param root {@link Dependency}
      * @return {@link CollectorResult}
      * @throws DependencyCollectorException in case of an error.
+     * @throws IllegalArgumentException in case of parameter <code>buildingRequest</code> is <code>null</code> or
+     *             parameter <code>root</code> is <code>null</code>.
      */
     CollectorResult collectDependencies( ProjectBuildingRequest buildingRequest, Dependency root )
         throws DependencyCollectorException;
@@ -50,6 +52,8 @@ public interface DependencyCollector
      * @return {@link CollectorResult}
      * @throws DependencyCollectorException in case of an error which can be a component lookup error or
      *  an error while trying to look up the dependencies.
+     * @throws IllegalArgumentException in case of parameter <code>buildingRequest</code> is <code>null</code> or
+     *             parameter <code>root</code> is <code>null</code>.
      */
     CollectorResult collectDependencies( ProjectBuildingRequest buildingRequest, DependableCoordinate root )
                     throws DependencyCollectorException;
@@ -60,6 +64,8 @@ public interface DependencyCollector
      * @return {@link CollectorResult}
      * @throws DependencyCollectorException in case of an error which can be a component lookup error or
      *  an error while trying to look up the dependencies.
+     * @throws IllegalArgumentException in case of parameter <code>buildingRequest</code> is <code>null</code> or
+     *             parameter <code>root</code> is <code>null</code>.
      */
     CollectorResult collectDependencies( ProjectBuildingRequest buildingRequest, Model root )
                     throws DependencyCollectorException;
diff --git a/src/main/java/org/apache/maven/shared/dependencies/collect/internal/DefaultDependencyCollector.java b/src/main/java/org/apache/maven/shared/dependencies/collect/internal/DefaultDependencyCollector.java
index 19bdc32..ed8f331 100644
--- a/src/main/java/org/apache/maven/shared/dependencies/collect/internal/DefaultDependencyCollector.java
+++ b/src/main/java/org/apache/maven/shared/dependencies/collect/internal/DefaultDependencyCollector.java
@@ -36,18 +36,21 @@ import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
 
 /**
  * This DependencyCollector passes the request to the proper Maven 3.x implementation
- *  
+ * 
  * @author Robert Scholte
  */
 @Component( role = DependencyCollector.class, hint = "default" )
-public class DefaultDependencyCollector implements DependencyCollector, Contextualizable 
+public class DefaultDependencyCollector
+    implements DependencyCollector, Contextualizable
 {
     private PlexusContainer container;
-   
+
     @Override
     public CollectorResult collectDependencies( ProjectBuildingRequest buildingRequest, Dependency root )
         throws DependencyCollectorException
     {
+        validateParameters( buildingRequest, root );
+
         try
         {
             String hint = isMaven31() ? "maven31" : "maven3";
@@ -61,11 +64,13 @@ public class DefaultDependencyCollector implements DependencyCollector, Contextu
             throw new DependencyCollectorException( e.getMessage(), e );
         }
     }
-    
+
     @Override
     public CollectorResult collectDependencies( ProjectBuildingRequest buildingRequest, DependableCoordinate root )
         throws DependencyCollectorException
     {
+        validateParameters( buildingRequest, root );
+
         try
         {
             String hint = isMaven31() ? "maven31" : "maven3";
@@ -79,11 +84,13 @@ public class DefaultDependencyCollector implements DependencyCollector, Contextu
             throw new DependencyCollectorException( e.getMessage(), e );
         }
     }
-    
+
     @Override
     public CollectorResult collectDependencies( ProjectBuildingRequest buildingRequest, Model root )
         throws DependencyCollectorException
     {
+        validateParameters( buildingRequest, root );
+
         try
         {
             String hint = isMaven31() ? "maven31" : "maven3";
@@ -98,6 +105,41 @@ public class DefaultDependencyCollector implements DependencyCollector, Contextu
         }
     }
 
+    private void validateParameters( ProjectBuildingRequest buildingRequest, DependableCoordinate root )
+    {
+        validateBuildingRequest( buildingRequest );
+        if ( root == null )
+        {
+            throw new IllegalArgumentException( "The parameter root is not allowed to be null." );
+        }
+    }
+
+    private void validateParameters( ProjectBuildingRequest buildingRequest, Dependency root )
+    {
+        validateBuildingRequest( buildingRequest );
+        if ( root == null )
+        {
+            throw new IllegalArgumentException( "The parameter root is not allowed to be null." );
+        }
+    }
+
+    private void validateParameters( ProjectBuildingRequest buildingRequest, Model root )
+    {
+        validateBuildingRequest( buildingRequest );
+        if ( root == null )
+        {
+            throw new IllegalArgumentException( "The parameter root is not allowed to be null." );
+        }
+    }
+
+    private void validateBuildingRequest( ProjectBuildingRequest buildingRequest )
+    {
+        if ( buildingRequest == null )
+        {
+            throw new IllegalArgumentException( "The parameter buildingRequest is not allowed to be null." );
+        }
+    }
+
     /**
      * @return true if the current Maven version is Maven 3.1.
      */
diff --git a/src/main/java/org/apache/maven/shared/dependencies/resolve/internal/DefaultDependencyResolver.java b/src/main/java/org/apache/maven/shared/dependencies/resolve/internal/DefaultDependencyResolver.java
index a58a80a..4db1828 100644
--- a/src/main/java/org/apache/maven/shared/dependencies/resolve/internal/DefaultDependencyResolver.java
+++ b/src/main/java/org/apache/maven/shared/dependencies/resolve/internal/DefaultDependencyResolver.java
@@ -51,7 +51,7 @@ public class DefaultDependencyResolver
                                                          Collection<Dependency> coordinates,
                                                          Collection<Dependency> managedDependencies,
                                                          TransformableFilter filter )
-                                                             throws DependencyResolverException
+        throws DependencyResolverException
     {
         try
         {
@@ -70,8 +70,9 @@ public class DefaultDependencyResolver
     @Override
     public Iterable<ArtifactResult> resolveDependencies( ProjectBuildingRequest buildingRequest,
                                                          DependableCoordinate coordinate, TransformableFilter filter )
-                                                             throws DependencyResolverException
+        throws DependencyResolverException
     {
+        validateParameters( buildingRequest, coordinate, filter );
         try
         {
             String hint = isMaven31() ? "maven31" : "maven3";
@@ -85,12 +86,13 @@ public class DefaultDependencyResolver
             throw new DependencyResolverException( e.getMessage(), e );
         }
     }
-    
+
     @Override
-    public Iterable<ArtifactResult> resolveDependencies( ProjectBuildingRequest buildingRequest,
-                                                         Model model, TransformableFilter filter )
+    public Iterable<ArtifactResult> resolveDependencies( ProjectBuildingRequest buildingRequest, Model model,
+                                                         TransformableFilter filter )
         throws DependencyResolverException
     {
+        validateParameters( buildingRequest, model, filter );
         try
         {
             String hint = isMaven31() ? "maven31" : "maven3";
@@ -138,4 +140,43 @@ public class DefaultDependencyResolver
     {
         container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
     }
+
+    private void validateParameters( ProjectBuildingRequest buildingRequest, DependableCoordinate coordinate,
+                                     TransformableFilter filter )
+    {
+        validateBuildingRequest( buildingRequest );
+        if ( coordinate == null )
+        {
+            throw new IllegalArgumentException( "The parameter coordinate is not allowed to be null." );
+        }
+        if ( filter == null )
+        {
+            throw new IllegalArgumentException( "The parameter filter is not allowed to be null." );
+        }
+
+    }
+
+    private void validateParameters( ProjectBuildingRequest buildingRequest, Model model,
+                                     TransformableFilter filter )
+    {
+        validateBuildingRequest( buildingRequest );
+        if ( model == null )
+        {
+            throw new IllegalArgumentException( "The parameter model is not allowed to be null." );
+        }
+        if ( filter == null )
+        {
+            throw new IllegalArgumentException( "The parameter filter is not allowed to be null." );
+        }
+
+    }
+
+    private void validateBuildingRequest( ProjectBuildingRequest buildingRequest )
+    {
+        if ( buildingRequest == null )
+        {
+            throw new IllegalArgumentException( "The parameter buildingRequest is not allowed to be null." );
+        }
+    }
+
 }
diff --git a/src/main/java/org/apache/maven/shared/project/deploy/ProjectDeployer.java b/src/main/java/org/apache/maven/shared/project/deploy/ProjectDeployer.java
index 2c4519b..b09adeb 100644
--- a/src/main/java/org/apache/maven/shared/project/deploy/ProjectDeployer.java
+++ b/src/main/java/org/apache/maven/shared/project/deploy/ProjectDeployer.java
@@ -21,6 +21,7 @@ package org.apache.maven.shared.project.deploy;
 
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.project.ProjectBuildingRequest;
+import org.apache.maven.shared.artifact.deploy.ArtifactDeployerException;
 import org.apache.maven.shared.project.NoFileAssignedException;
 
 /**
@@ -55,11 +56,12 @@ public interface ProjectDeployer
      * @param request {@link ProjectDeployerRequest}
      * @param artifactRepository {@link ArtifactRepository}
      * @throws NoFileAssignedException In case of missing file which has not been assigned to project.
-     * @throws IllegalArgumentException in case of artifact is not correctly assigned.
+     * @throws ArtifactDeployerException in case of artifact could not correctly deployed.
+     * @throws IllegalArgumentException in case <code>buildingRequest</code> is <code>null</code>, <code>request</code>
+     *             is <code>null</code> or <code>artifactRepository</code> is <code>null</code>.
      */
     void deploy( ProjectBuildingRequest buildingRequest, ProjectDeployerRequest request,
-                        ArtifactRepository artifactRepository )
-        throws NoFileAssignedException, IllegalArgumentException;
-
+                 ArtifactRepository artifactRepository )
+        throws NoFileAssignedException, ArtifactDeployerException;
 
 }
diff --git a/src/main/java/org/apache/maven/shared/project/deploy/internal/DefaultProjectDeployer.java b/src/main/java/org/apache/maven/shared/project/deploy/internal/DefaultProjectDeployer.java
index e1a14af..b4d88ff 100644
--- a/src/main/java/org/apache/maven/shared/project/deploy/internal/DefaultProjectDeployer.java
+++ b/src/main/java/org/apache/maven/shared/project/deploy/internal/DefaultProjectDeployer.java
@@ -54,24 +54,19 @@ public class DefaultProjectDeployer
     private ArtifactDeployer deployer;
 
     /**
-     * This will deploy a single project which may contain several artifacts into the appropriate remote repository.
-     * 
-     * @param buildingRequest {@link ProjectBuildingRequest}
-     * @param request {@link ProjectDeployerRequest}
-     * @param artifactRepository {@link ArtifactRepository}
-     * @throws IllegalArgumentException in case of artifact is not correctly assigned.
-     * @throws NoFileAssignedException In case no file has been assigned to main file.
+     * {@inheritDoc}
      */
-    public void deploy( ProjectBuildingRequest buildingRequest, ProjectDeployerRequest request,
+    public void deploy( ProjectBuildingRequest buildingRequest, ProjectDeployerRequest projectDeployerRequest,
                         ArtifactRepository artifactRepository )
-        throws NoFileAssignedException, IllegalArgumentException
+        throws NoFileAssignedException, IllegalArgumentException, ArtifactDeployerException
     {
+        validateParameters( buildingRequest, projectDeployerRequest, artifactRepository );
 
-        Artifact artifact = request.getProject().getArtifact();
-        String packaging = request.getProject().getPackaging();
-        File pomFile = request.getProject().getFile();
+        Artifact artifact = projectDeployerRequest.getProject().getArtifact();
+        String packaging = projectDeployerRequest.getProject().getPackaging();
+        File pomFile = projectDeployerRequest.getProject().getFile();
 
-        List<Artifact> attachedArtifacts = request.getProject().getAttachedArtifacts();
+        List<Artifact> attachedArtifacts = projectDeployerRequest.getProject().getAttachedArtifacts();
 
         // Deploy the POM
         boolean isPomArtifact = "pom".equals( packaging );
@@ -85,54 +80,68 @@ public class DefaultProjectDeployer
             artifact.addMetadata( metadata );
         }
 
-        if ( request.isUpdateReleaseInfo() )
+        // FIXME: It does not make sense to set an artifact explicitly to a "Release"
+        // cause this should be choosen only by the not existing of "-SNAPSHOT" in the
+        // version.
+        if ( projectDeployerRequest.isUpdateReleaseInfo() )
         {
             artifact.setRelease( true );
         }
 
         artifact.setRepository( artifactRepository );
 
-        int retryFailedDeploymentCount = request.getRetryFailedDeploymentCount();
+        int retryFailedDeploymentCount = projectDeployerRequest.getRetryFailedDeploymentCount();
 
-        try
+        List<Artifact> deployableArtifacts = new ArrayList<Artifact>();
+        if ( isPomArtifact )
+        {
+            deployableArtifacts.add( artifact );
+        }
+        else
         {
-            List<Artifact> deployableArtifacts = new ArrayList<Artifact>();
-            if ( isPomArtifact )
+            File file = artifact.getFile();
+
+            if ( file != null && file.isFile() )
             {
                 deployableArtifacts.add( artifact );
             }
-            else
+            else if ( !attachedArtifacts.isEmpty() )
             {
-                File file = artifact.getFile();
-
-                if ( file != null && file.isFile() )
-                {
-                    deployableArtifacts.add( artifact );
-                }
-                else if ( !attachedArtifacts.isEmpty() )
-                {
-                    // TODO: Reconsider this exception? Better Exception type?
-                    throw new NoFileAssignedException( "The packaging plugin for this project did not assign "
-                        + "a main file to the project but it has attachments. Change packaging to 'pom'." );
-                }
-                else
-                {
-                    // TODO: Reconsider this exception? Better Exception type?
-                    throw new NoFileAssignedException( "The packaging for this project did not assign "
-                        + "a file to the build artifact" );
-                }
+                // TODO: Reconsider this exception? Better Exception type?
+                throw new NoFileAssignedException( "The packaging plugin for this project did not assign "
+                    + "a main file to the project but it has attachments. Change packaging to 'pom'." );
             }
-
-            for ( Artifact attached : attachedArtifacts )
+            else
             {
-                deployableArtifacts.add( attached );
+                // TODO: Reconsider this exception? Better Exception type?
+                throw new NoFileAssignedException( "The packaging for this project did not assign "
+                    + "a file to the build artifact" );
             }
+        }
+
+        for ( Artifact attached : attachedArtifacts )
+        {
+            deployableArtifacts.add( attached );
+        }
 
-            deploy( buildingRequest, deployableArtifacts, artifactRepository, retryFailedDeploymentCount );
+        deploy( buildingRequest, deployableArtifacts, artifactRepository, retryFailedDeploymentCount );
+    }
+
+    private void validateParameters( ProjectBuildingRequest buildingRequest,
+                                     ProjectDeployerRequest projectDeployerRequest,
+                                     ArtifactRepository artifactRepository )
+    {
+        if ( buildingRequest == null )
+        {
+            throw new IllegalArgumentException( "The parameter buildingRequest is not allowed to be null." );
+        }
+        if ( projectDeployerRequest == null )
+        {
+            throw new IllegalArgumentException( "The parameter projectDeployerRequest is not allowed to be null." );
         }
-        catch ( ArtifactDeployerException e )
+        if ( artifactRepository == null )
         {
-            throw new IllegalArgumentException( e.getMessage(), e );
+            throw new IllegalArgumentException( "The parameter artifactRepository is not allowed to be null." );
         }
     }
 
diff --git a/src/main/java/org/apache/maven/shared/project/install/ProjectInstaller.java b/src/main/java/org/apache/maven/shared/project/install/ProjectInstaller.java
index 0ddc46c..0fab22e 100644
--- a/src/main/java/org/apache/maven/shared/project/install/ProjectInstaller.java
+++ b/src/main/java/org/apache/maven/shared/project/install/ProjectInstaller.java
@@ -54,15 +54,15 @@ public interface ProjectInstaller
      *  installer.install( session.getProjectBuildingRequest(), pir );
      * </pre>
      * 
-     * To set a different local repository than the current one in the Maven session, you can inject an instance of
-     * the <code>RepositoryManager</code> and set the path to the local repository, called 
-     * <code>localRepositoryPath</code>, as such:
+     * To set a different local repository than the current one in the Maven session, you can inject an instance of the
+     * <code>RepositoryManager</code> and set the path to the local repository, called <code>localRepositoryPath</code>,
+     * as such:
      * 
      * <pre class="java">
-     *  &#64;Component
-     *  private RepositoryManager repositoryManager;
+     * &#64;Component
+     * private RepositoryManager repositoryManager;
      * 
-     *  buildingRequest = repositoryManager.setLocalRepositoryBasedir( buildingRequest, localRepositoryPath );
+     * buildingRequest = repositoryManager.setLocalRepositoryBasedir( buildingRequest, localRepositoryPath );
      * </pre>
      * 
      * @param projectBuildingRequest {@link ProjectBuildingRequest}
@@ -74,6 +74,6 @@ public interface ProjectInstaller
      *             parameter <code>projectInstallerRequest</code> is <code>null</code>.
      */
     void install( ProjectBuildingRequest projectBuildingRequest, ProjectInstallerRequest projectInstallerRequest )
-        throws IOException, ArtifactInstallerException, NoFileAssignedException, IllegalArgumentException;
+        throws IOException, ArtifactInstallerException, NoFileAssignedException;
 
 }
diff --git a/src/main/java/org/apache/maven/shared/project/install/internal/DefaultProjectInstaller.java b/src/main/java/org/apache/maven/shared/project/install/internal/DefaultProjectInstaller.java
index 5d277d3..799790a 100644
--- a/src/main/java/org/apache/maven/shared/project/install/internal/DefaultProjectInstaller.java
+++ b/src/main/java/org/apache/maven/shared/project/install/internal/DefaultProjectInstaller.java
@@ -71,7 +71,6 @@ public class DefaultProjectInstaller
     public void install( ProjectBuildingRequest buildingRequest, ProjectInstallerRequest installerRequest )
         throws IOException, ArtifactInstallerException, NoFileAssignedException, IllegalArgumentException
     {
-
         validateParameters( buildingRequest, installerRequest );
         MavenProject project = installerRequest.getProject();
         boolean createChecksum = installerRequest.isCreateChecksum();
@@ -157,7 +156,7 @@ public class DefaultProjectInstaller
             throw new IllegalArgumentException( "The parameter installerRequest is not allowed to be null." );
         }
     }
-    
+
     /**
      * Installs the checksums for the specified artifact if this has been enabled in the plugin configuration. This
      * method creates checksums for files that have already been installed to the local repo to account for on-the-fly
diff --git a/src/test/java/org/apache/maven/shared/artifact/deploy/internal/DefaultArtifactDeployerTest.java b/src/test/java/org/apache/maven/shared/artifact/deploy/internal/DefaultArtifactDeployerTest.java
index cfd9587..5e17f60 100644
--- a/src/test/java/org/apache/maven/shared/artifact/deploy/internal/DefaultArtifactDeployerTest.java
+++ b/src/test/java/org/apache/maven/shared/artifact/deploy/internal/DefaultArtifactDeployerTest.java
@@ -64,9 +64,10 @@ public class DefaultArtifactDeployerTest
     public void deployShouldReturnIllegalArgumentExceptionForSecondParameterWithNull()
         throws ArtifactDeployerException
     {
+        ProjectBuildingRequest pbr = mock( ProjectBuildingRequest.class );
+
         thrown.expect( IllegalArgumentException.class );
         thrown.expectMessage( "The parameter mavenArtifacts is not allowed to be null." );
-        ProjectBuildingRequest pbr = mock( ProjectBuildingRequest.class );
         dap.deploy( pbr, null );
     }
 
@@ -74,9 +75,10 @@ public class DefaultArtifactDeployerTest
     public void deployShouldReturnIllegalArgumentExceptionForSecondParameterWithEmpty()
         throws ArtifactDeployerException
     {
+        ProjectBuildingRequest pbr = mock( ProjectBuildingRequest.class );
+
         thrown.expect( IllegalArgumentException.class );
         thrown.expectMessage( "The collection mavenArtifacts is not allowed to be empty." );
-        ProjectBuildingRequest pbr = mock( ProjectBuildingRequest.class );
         dap.deploy( pbr, Collections.<Artifact>emptyList() );
     }
 
@@ -94,9 +96,10 @@ public class DefaultArtifactDeployerTest
     public void deploy3ParametersShouldReturnIllegalArgumentExceptionForSecondParameterWithNull()
         throws ArtifactDeployerException
     {
+        ProjectBuildingRequest pbr = mock( ProjectBuildingRequest.class );
+
         thrown.expect( IllegalArgumentException.class );
         thrown.expectMessage( "The parameter mavenArtifacts is not allowed to be null." );
-        ProjectBuildingRequest pbr = mock( ProjectBuildingRequest.class );
         dap.deploy( pbr, null, null );
     }
 
@@ -104,9 +107,10 @@ public class DefaultArtifactDeployerTest
     public void deploy3ParametersShouldReturnIllegalArgumentExceptionForSecondParameterWithEmpty()
         throws ArtifactDeployerException
     {
+        ProjectBuildingRequest pbr = mock( ProjectBuildingRequest.class );
+
         thrown.expect( IllegalArgumentException.class );
         thrown.expectMessage( "The collection mavenArtifacts is not allowed to be empty." );
-        ProjectBuildingRequest pbr = mock( ProjectBuildingRequest.class );
         dap.deploy( pbr, null, Collections.<Artifact>emptyList() );
     }
 
diff --git a/src/test/java/org/apache/maven/shared/artifact/install/internal/DefaultArtifactInstallerTest.java b/src/test/java/org/apache/maven/shared/artifact/install/internal/DefaultArtifactInstallerTest.java
index 144f33f..d26ed01 100644
--- a/src/test/java/org/apache/maven/shared/artifact/install/internal/DefaultArtifactInstallerTest.java
+++ b/src/test/java/org/apache/maven/shared/artifact/install/internal/DefaultArtifactInstallerTest.java
@@ -45,8 +45,7 @@ public class DefaultArtifactInstallerTest
     public ExpectedException thrown = ExpectedException.none();
 
     @Test
-    public void installShouldReturnIllegalArgumentExceptionForFirstParameterWithNull()
-        throws ArtifactInstallerException
+    public void installShouldReturnIllegalArgumentExceptionForFirstParameterWithNull() throws IllegalArgumentException, ArtifactInstallerException
     {
         DefaultArtifactInstaller dai = new DefaultArtifactInstaller();
 
diff --git a/src/test/java/org/apache/maven/shared/dependencies/collect/internal/DefaultDependencyCollectorTest.java b/src/test/java/org/apache/maven/shared/dependencies/collect/internal/DefaultDependencyCollectorTest.java
new file mode 100644
index 0000000..5e48299
--- /dev/null
+++ b/src/test/java/org/apache/maven/shared/dependencies/collect/internal/DefaultDependencyCollectorTest.java
@@ -0,0 +1,115 @@
+package org.apache.maven.shared.dependencies.collect.internal;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import static org.mockito.Mockito.mock;
+
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.Model;
+import org.apache.maven.project.ProjectBuildingRequest;
+import org.apache.maven.shared.artifact.deploy.ArtifactDeployerException;
+import org.apache.maven.shared.artifact.resolve.ArtifactResolverException;
+import org.apache.maven.shared.dependencies.DependableCoordinate;
+import org.apache.maven.shared.dependencies.collect.DependencyCollector;
+import org.apache.maven.shared.dependencies.collect.DependencyCollectorException;
+import org.apache.maven.shared.dependencies.collect.internal.DefaultDependencyCollector;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+public class DefaultDependencyCollectorTest
+{
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    private DependencyCollector dc;
+
+    @Before
+    public void setUp()
+    {
+        dc = new DefaultDependencyCollector();
+    }
+
+    @Test
+    public void collectDependenciesWithDependableCoordinatShouldFailWithIAEWhenParameterBuildingRequestIsNull()
+        throws ArtifactDeployerException, ArtifactResolverException, DependencyCollectorException
+    {
+        thrown.expect( IllegalArgumentException.class );
+        thrown.expectMessage( "The parameter buildingRequest is not allowed to be null." );
+
+        dc.collectDependencies( null, (DependableCoordinate) null );
+    }
+
+    @Test
+    public void collectDependenciesWithDependableCoordinatShouldFailWithIAEWhenParameterRootIsNull()
+        throws ArtifactDeployerException, ArtifactResolverException, DependencyCollectorException
+    {
+        thrown.expect( IllegalArgumentException.class );
+        thrown.expectMessage( "The parameter root is not allowed to be null." );
+
+        ProjectBuildingRequest request = mock( ProjectBuildingRequest.class );
+        dc.collectDependencies( request, (DependableCoordinate) null );
+    }
+
+    @Test
+    public void collectDependenciesWithDependencyShouldFailWithIAEWhenParameterBuildingRequestIsNull()
+        throws ArtifactDeployerException, ArtifactResolverException, DependencyCollectorException
+    {
+        thrown.expect( IllegalArgumentException.class );
+        thrown.expectMessage( "The parameter buildingRequest is not allowed to be null." );
+
+        dc.collectDependencies( null, (Dependency) null );
+    }
+
+    @Test
+    public void collectDependenciesWithDependencyShouldFailWithIAEWhenParameterRootIsNull()
+        throws ArtifactDeployerException, ArtifactResolverException, DependencyCollectorException
+    {
+        thrown.expect( IllegalArgumentException.class );
+        thrown.expectMessage( "The parameter root is not allowed to be null." );
+
+        ProjectBuildingRequest request = mock( ProjectBuildingRequest.class );
+        dc.collectDependencies( request, (Dependency) null );
+    }
+
+    @Test
+    public void collectDependenciesWithModelShouldFailWithIAEWhenParameterBuildingRequestIsNull()
+        throws ArtifactDeployerException, ArtifactResolverException, DependencyCollectorException
+    {
+        thrown.expect( IllegalArgumentException.class );
+        thrown.expectMessage( "The parameter buildingRequest is not allowed to be null." );
+
+        dc.collectDependencies( null, (Model) null );
+    }
+
+    @Test
+    public void collectDependenciesWithModelShouldFailWithIAEWhenParameterRootIsNull()
+        throws ArtifactDeployerException, ArtifactResolverException, DependencyCollectorException
+    {
+        thrown.expect( IllegalArgumentException.class );
+        thrown.expectMessage( "The parameter root is not allowed to be null." );
+
+        ProjectBuildingRequest request = mock( ProjectBuildingRequest.class );
+        dc.collectDependencies( request, (Model) null );
+    }
+
+}
diff --git a/src/test/java/org/apache/maven/shared/dependencies/resolve/internal/DefaultDependencyResolverTest.java b/src/test/java/org/apache/maven/shared/dependencies/resolve/internal/DefaultDependencyResolverTest.java
new file mode 100644
index 0000000..2a512ac
--- /dev/null
+++ b/src/test/java/org/apache/maven/shared/dependencies/resolve/internal/DefaultDependencyResolverTest.java
@@ -0,0 +1,118 @@
+package org.apache.maven.shared.dependencies.resolve.internal;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import static org.mockito.Mockito.mock;
+
+import org.apache.maven.model.Model;
+import org.apache.maven.project.ProjectBuildingRequest;
+import org.apache.maven.shared.dependencies.DependableCoordinate;
+import org.apache.maven.shared.dependencies.resolve.DependencyResolver;
+import org.apache.maven.shared.dependencies.resolve.DependencyResolverException;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+/**
+ * Check the parameter contracts which have been made based on the interface {@link DependencyResolver}.
+ * 
+ * @author Karl Heinz Marbaise <a href="mailto:khmarbaise@apache.org">khmabaise@apache.org</a>
+ */
+public class DefaultDependencyResolverTest
+{
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    private DependencyResolver dr;
+
+    @Before
+    public void setUp()
+    {
+        dr = new DefaultDependencyResolver();
+    }
+
+    @Test
+    public void resolveDependenciesWithDependableCoordinatShouldFailWithIAEWhenParameterBuildingRequestIsNull()
+        throws DependencyResolverException
+    {
+        thrown.expect( IllegalArgumentException.class );
+        thrown.expectMessage( "The parameter buildingRequest is not allowed to be null." );
+
+        dr.resolveDependencies( null, (DependableCoordinate) null, null );
+    }
+
+    @Test
+    public void resolveDependenciesWithDependableCoordinatShouldFailWithIAEWhenParameterCoordinateIsNull()
+        throws DependencyResolverException
+    {
+        thrown.expect( IllegalArgumentException.class );
+        thrown.expectMessage( "The parameter coordinate is not allowed to be null." );
+
+        ProjectBuildingRequest request = mock( ProjectBuildingRequest.class );
+        dr.resolveDependencies( request, (DependableCoordinate) null, null );
+    }
+
+    @Test
+    public void resolveDependenciesWithDependableCoordinatShouldFailWithIAEWhenParameterFilterIsNull()
+        throws DependencyResolverException
+    {
+        thrown.expect( IllegalArgumentException.class );
+        thrown.expectMessage( "The parameter filter is not allowed to be null." );
+
+        ProjectBuildingRequest request = mock( ProjectBuildingRequest.class );
+        DependableCoordinate dc = mock( DependableCoordinate.class );
+        dr.resolveDependencies( request, dc, null );
+    }
+
+    @Test
+    public void resolveDependenciesWithModelShouldFailWithIAEWhenParameterBuildingRequestIsNull()
+        throws DependencyResolverException
+    {
+        thrown.expect( IllegalArgumentException.class );
+        thrown.expectMessage( "The parameter buildingRequest is not allowed to be null." );
+
+        dr.resolveDependencies( null, (Model) null, null );
+    }
+
+    @Test
+    public void resolveDependenciesWithModelShouldFailWithIAEWhenParameterModelIsNull()
+        throws DependencyResolverException
+    {
+        thrown.expect( IllegalArgumentException.class );
+        thrown.expectMessage( "The parameter model is not allowed to be null." );
+
+        ProjectBuildingRequest request = mock( ProjectBuildingRequest.class );
+        dr.resolveDependencies( request, (Model) null, null );
+    }
+
+    @Test
+    public void resolveDependenciesWithModelShouldFailWithIAEWhenParameterFilterIsNull()
+        throws DependencyResolverException
+    {
+        thrown.expect( IllegalArgumentException.class );
+        thrown.expectMessage( "The parameter filter is not allowed to be null." );
+
+        ProjectBuildingRequest request = mock( ProjectBuildingRequest.class );
+        Model model = mock( Model.class );
+        dr.resolveDependencies( request, model, null );
+    }
+
+}
diff --git a/src/test/java/org/apache/maven/shared/dependency/DefaultDependencyCoordinateTest.java b/src/test/java/org/apache/maven/shared/dependency/DefaultDependencyCoordinateTest.java
index a52d055..f3d00ea 100644
--- a/src/test/java/org/apache/maven/shared/dependency/DefaultDependencyCoordinateTest.java
+++ b/src/test/java/org/apache/maven/shared/dependency/DefaultDependencyCoordinateTest.java
@@ -18,6 +18,7 @@ package org.apache.maven.shared.dependency;
  * specific language governing permissions and limitations
  * under the License.
  */
+
 import static org.junit.Assert.assertEquals;
 
 import org.apache.maven.shared.dependencies.DefaultDependableCoordinate;
diff --git a/src/test/java/org/apache/maven/shared/project/deploy/internal/DefaultProjectDeployerTest.java b/src/test/java/org/apache/maven/shared/project/deploy/internal/DefaultProjectDeployerTest.java
new file mode 100644
index 0000000..2d54a24
--- /dev/null
+++ b/src/test/java/org/apache/maven/shared/project/deploy/internal/DefaultProjectDeployerTest.java
@@ -0,0 +1,82 @@
+package org.apache.maven.shared.project.deploy.internal;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import static org.mockito.Mockito.mock;
+
+import org.apache.maven.project.ProjectBuildingRequest;
+import org.apache.maven.shared.artifact.deploy.ArtifactDeployerException;
+import org.apache.maven.shared.project.NoFileAssignedException;
+import org.apache.maven.shared.project.deploy.ProjectDeployer;
+import org.apache.maven.shared.project.deploy.ProjectDeployerRequest;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+/**
+ * Check the parameter contracts which have been made based on the interface {@link ProjectDeployer}.
+ * 
+ * @author Karl Heinz Marbaise <a href="mailto:khmarbaise@apache.org">khmabaise@apache.org</a>
+ */
+public class DefaultProjectDeployerTest
+{
+    @Rule
+    public ExpectedException expectedException = ExpectedException.none();
+
+    @Test
+    public void deployShouldFailWithIAEWhileBuildingRequestIsNull()
+        throws IllegalArgumentException, NoFileAssignedException, ArtifactDeployerException
+    {
+        ProjectDeployer dpi = new DefaultProjectDeployer();
+
+        expectedException.expect( IllegalArgumentException.class );
+        expectedException.expectMessage( "The parameter buildingRequest is not allowed to be null." );
+
+        dpi.deploy( null, null, null );
+    }
+
+    @Test
+    public void deployShouldFailWithIAEWhileProjectDeployerRequestIsNull()
+        throws IllegalArgumentException, NoFileAssignedException, ArtifactDeployerException
+    {
+        ProjectDeployer dpi = new DefaultProjectDeployer();
+
+        expectedException.expect( IllegalArgumentException.class );
+        expectedException.expectMessage( "The parameter projectDeployerRequest is not allowed to be null." );
+
+        ProjectBuildingRequest pbr = mock( ProjectBuildingRequest.class );
+        dpi.deploy( pbr, null, null );
+    }
+
+    @Test
+    public void deployShouldFailWithIAEWhileArtifactRepositoryIsNull()
+        throws IllegalArgumentException, NoFileAssignedException, ArtifactDeployerException
+    {
+        ProjectDeployer dpi = new DefaultProjectDeployer();
+
+        expectedException.expect( IllegalArgumentException.class );
+        expectedException.expectMessage( "The parameter artifactRepository is not allowed to be null." );
+
+        ProjectBuildingRequest pbr = mock( ProjectBuildingRequest.class );
+        ProjectDeployerRequest pdr = mock( ProjectDeployerRequest.class );
+        dpi.deploy( pbr, pdr, null );
+    }
+
+}
diff --git a/src/test/java/org/apache/maven/shared/project/install/internal/DefaultProjectInstallerTest.java b/src/test/java/org/apache/maven/shared/project/install/internal/DefaultProjectInstallerTest.java
index 7d1cc8e..f5d65a3 100644
--- a/src/test/java/org/apache/maven/shared/project/install/internal/DefaultProjectInstallerTest.java
+++ b/src/test/java/org/apache/maven/shared/project/install/internal/DefaultProjectInstallerTest.java
@@ -38,32 +38,33 @@ import org.junit.rules.ExpectedException;
  */
 public class DefaultProjectInstallerTest
 {
+
     @Rule
-    public ExpectedException thrown = ExpectedException.none();
+    public ExpectedException expectedException = ExpectedException.none();
 
     @Test
-    public void installShouldReturnIllegalArgumentExceptionWhereBuildingRequestIsNull()
+    public void installShouldFailWithIAEWhileBuildingRequestIsNull()
         throws IOException, ArtifactInstallerException, NoFileAssignedException
     {
-        DefaultProjectInstaller dai = new DefaultProjectInstaller();
+        ProjectInstaller dpi = new DefaultProjectInstaller();
+
+        expectedException.expect( IllegalArgumentException.class );
+        expectedException.expectMessage( "The parameter buildingRequest is not allowed to be null." );
 
-        thrown.expect( IllegalArgumentException.class );
-        thrown.expectMessage( "The parameter buildingRequest is not allowed to be null." );
-        dai.install( null, null );
+        dpi.install( null, null );
     }
 
     @Test
-    public void installShouldReturnIllegalArgumentExceptionWhereInstallerRequestIsNull()
+    public void installShouldFailWithIAEWhileProjectInstallerRequestIsNull()
         throws IOException, ArtifactInstallerException, NoFileAssignedException
     {
-        DefaultProjectInstaller dai = new DefaultProjectInstaller();
+        ProjectInstaller dpi = new DefaultProjectInstaller();
 
-        thrown.expect( IllegalArgumentException.class );
-        thrown.expectMessage( "The parameter installerRequest is not allowed to be null." );
+        expectedException.expect( IllegalArgumentException.class );
+        expectedException.expectMessage( "The parameter installerRequest is not allowed to be null." );
         ProjectBuildingRequest pbr = mock( ProjectBuildingRequest.class );
-        dai.install( pbr, null );
-    }
-
 
+        dpi.install( pbr, null );
+    }
 
 }

-- 
To stop receiving notification emails like this one, please contact
khmarbaise@apache.org.