Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
import org.apache.maven.model.Dependency;
import org.apache.maven.model.DependencyManagement;
import org.apache.maven.model.Exclusion;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory;
import org.apache.maven.plugins.dependency.testUtils.stubs.DependencyProjectStub;
import org.apache.maven.project.MavenProject;
Expand Down Expand Up @@ -192,60 +194,30 @@ public void testGetMismatch()
}

public void testMojo()
throws IOException
throws IOException, MojoExecutionException, MojoFailureException
{
mojo.setIgnoreDirect( false );
try
{
// test with nothing in depMgt
mojo.execute();
}
catch ( Exception e )
{
e.printStackTrace();
fail( "Caught Unexpected Exception:" + e.getLocalizedMessage() );
}
// test with nothing in depMgt
mojo.execute();

try
{
DependencyProjectStub project = (DependencyProjectStub) mojo.getProject();
project.setDependencyManagement( depMgt );
// test with exclusion
mojo.execute();
}
catch ( Exception e )
{
e.printStackTrace();
fail( "Caught Unexpected Exception:" + e.getLocalizedMessage() );
}
DependencyProjectStub project = (DependencyProjectStub) mojo.getProject();
project.setDependencyManagement( depMgt );
// test with exclusion
mojo.execute();

try
{
DependencyProjectStub project = (DependencyProjectStub) mojo.getProject();
project.setDependencyManagement( depMgt );
// test with exclusion
mojo.setFailBuild( true );
mojo.execute();
fail( "Expected exception to fail the build." );
}
catch ( Exception e )
catch ( MojoExecutionException e )
{
System.out.println( "Caught Expected Exception:" + e.getLocalizedMessage() );
}

try
{
DependencyProjectStub project = (DependencyProjectStub) mojo.getProject();
project.setDependencyManagement( depMgt );
// test with exclusion
mojo.setFailBuild( true );
mojo.setIgnoreDirect( true );
mojo.execute();
}
catch ( Exception e )
{
e.printStackTrace();
fail( "Caught Unexpected Exception:" + e.getLocalizedMessage() );
}
mojo.setFailBuild( true );
mojo.setIgnoreDirect( true );
mojo.execute();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import java.util.Set;

import static java.util.Collections.singletonList;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,6 @@ public class DependencyProjectStub

private List<ArtifactRepository> pluginArtifactRepositories;

// private ArtifactRepository releaseArtifactRepository;

// private ArtifactRepository snapshotArtifactRepository;

private List<Profile> activeProfiles;

private Set<Artifact> dependencyArtifacts;
Expand Down Expand Up @@ -615,6 +611,7 @@ public Scm getScm()
return null;
}

@Override
public void setMailingLists( List<MailingList> list )
{

Expand All @@ -630,6 +627,7 @@ public void addMailingList( MailingList mailingList )

}

@Override
public void setDevelopers( List<Developer> list )
{

Expand Down Expand Up @@ -951,6 +949,7 @@ public List<Extension> getBuildExtensions()
return Collections.emptyList();
}

@Override
public Set<Artifact> createArtifacts( ArtifactFactory artifactFactory, String string, ArtifactFilter artifactFilter )
throws InvalidDependencyVersionException
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public class TestClassifierTypeTranslator

Log log = new SilentLog();


private ArtifactHandlerManager artifactHandlerManager;

@Override
Expand All @@ -75,7 +74,6 @@ protected void setUp()
DependencyArtifactStubFactory factory = new DependencyArtifactStubFactory( null, false );
artifacts = factory.getMixedArtifacts();


MavenSession session = newMavenSession( new MavenProjectStub() );

DefaultRepositorySystemSession repoSession = (DefaultRepositorySystemSession) session.getRepositorySession();
Expand Down