You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by el...@apache.org on 2020/04/04 14:57:13 UTC
[maven-dependency-plugin] branch master updated: Replace more
deprecated and unused code (#36)
This is an automated email from the ASF dual-hosted git repository.
elharo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-dependency-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new b38a9b4 Replace more deprecated and unused code (#36)
b38a9b4 is described below
commit b38a9b40ff9b31673d79cc7ac2676692fc556bb8
Author: Elliotte Rusty Harold <el...@users.noreply.github.com>
AuthorDate: Sat Apr 4 10:57:08 2020 -0400
Replace more deprecated and unused code (#36)
* remove deprecated methods
* remove unthrown exceptions
* remove unused fields
---
.../fromDependencies/TestCopyDependenciesMojo.java | 25 +++++++++-------------
...ExcludeReactorProjectsDependencyFilterTest.java | 13 +++--------
.../translators/TestClassifierTypeTranslator.java | 11 ++--------
3 files changed, 15 insertions(+), 34 deletions(-)
diff --git a/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestCopyDependenciesMojo.java b/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestCopyDependenciesMojo.java
index b90cfd3..f6fe820 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestCopyDependenciesMojo.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestCopyDependenciesMojo.java
@@ -44,6 +44,7 @@ public class TestCopyDependenciesMojo
CopyDependenciesMojo mojo;
+ @Override
protected void setUp()
throws Exception
{
@@ -106,9 +107,9 @@ public class TestCopyDependenciesMojo
}
/**
- * tests the proper discovery and configuration of the mojo
+ * Tests the proper discovery and configuration of the mojo.
*
- * @throws Exception in case of an error.
+ * @throws Exception in case of an error
*/
public void testMojo()
throws Exception
@@ -485,20 +486,14 @@ public class TestCopyDependenciesMojo
}
}
- public void testArtifactNotFound()
- throws Exception
- {
- dotestArtifactExceptions( false, true );
- }
-
public void testArtifactResolutionException()
- throws Exception
+ throws MojoFailureException
{
- dotestArtifactExceptions( true, false );
+ dotestArtifactExceptions();
}
- public void dotestArtifactExceptions( boolean are, boolean anfe )
- throws Exception
+ public void dotestArtifactExceptions()
+ throws MojoFailureException
{
mojo.classifier = "jdk";
mojo.type = "java-sources";
@@ -552,7 +547,7 @@ public class TestCopyDependenciesMojo
}
public void testOverWriteRelease()
- throws MojoExecutionException, InterruptedException, IOException, MojoFailureException
+ throws MojoExecutionException, IOException, MojoFailureException
{
Set<Artifact> artifacts = new HashSet<>();
@@ -584,7 +579,7 @@ public class TestCopyDependenciesMojo
}
public void testDontOverWriteSnap()
- throws MojoExecutionException, InterruptedException, IOException, MojoFailureException
+ throws MojoExecutionException, IOException, MojoFailureException
{
Set<Artifact> artifacts = new HashSet<>();
@@ -615,7 +610,7 @@ public class TestCopyDependenciesMojo
}
public void testOverWriteSnap()
- throws MojoExecutionException, InterruptedException, IOException, MojoFailureException
+ throws MojoExecutionException, IOException, MojoFailureException
{
Set<Artifact> artifacts = new HashSet<>();
diff --git a/src/test/java/org/apache/maven/plugins/dependency/resolvers/ExcludeReactorProjectsDependencyFilterTest.java b/src/test/java/org/apache/maven/plugins/dependency/resolvers/ExcludeReactorProjectsDependencyFilterTest.java
index 0119358..ee66875 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/resolvers/ExcludeReactorProjectsDependencyFilterTest.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/resolvers/ExcludeReactorProjectsDependencyFilterTest.java
@@ -34,9 +34,6 @@ import java.util.HashSet;
import java.util.Set;
import static java.util.Collections.singletonList;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -79,9 +76,7 @@ public class ExcludeReactorProjectsDependencyFilterTest extends AbstractDependen
}
};
- final boolean result = filter.accept( node , Collections.<Node>emptyList() );
-
- assertThat( result, is( false ));
+ assertFalse( filter.accept( node , Collections.<Node>emptyList() ) );
}
public void testRejectWithLogging()
@@ -124,7 +119,7 @@ public class ExcludeReactorProjectsDependencyFilterTest extends AbstractDependen
ArgumentCaptor<String> captor = ArgumentCaptor.forClass( String.class );
verify( log ).debug( captor.capture() );
- assertThat( captor.getValue(), containsString( "Skipped dependency" ) );
+ assertTrue( captor.getValue().contains( "Skipped dependency" ) );
}
public void testAccept()
@@ -163,8 +158,6 @@ public class ExcludeReactorProjectsDependencyFilterTest extends AbstractDependen
}
};
- final boolean result = filter.accept( node , Collections.<Node>emptyList() );
-
- assertThat( result, is( true ));
+ assertTrue( filter.accept( node , Collections.<Node>emptyList() ) );
}
}
\ No newline at end of file
diff --git a/src/test/java/org/apache/maven/plugins/dependency/utils/translators/TestClassifierTypeTranslator.java b/src/test/java/org/apache/maven/plugins/dependency/utils/translators/TestClassifierTypeTranslator.java
index 02f2bb8..5c202a6 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/utils/translators/TestClassifierTypeTranslator.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/utils/translators/TestClassifierTypeTranslator.java
@@ -37,9 +37,7 @@ import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
import org.apache.maven.plugin.testing.stubs.StubArtifactRepository;
import org.apache.maven.plugins.dependency.AbstractDependencyMojoTestCase;
import org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory;
-import org.apache.maven.project.ProjectBuildingRequest;
import org.apache.maven.shared.transfer.artifact.ArtifactCoordinate;
-import org.apache.maven.shared.transfer.repository.RepositoryManager;
import org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager;
import org.sonatype.aether.util.DefaultRepositorySystemSession;
@@ -57,12 +55,10 @@ public class TestClassifierTypeTranslator
Log log = new SilentLog();
- private RepositoryManager repoManager;
-
- private ProjectBuildingRequest buildingRequest;
private ArtifactHandlerManager artifactHandlerManager;
+ @Override
protected void setUp()
throws Exception
{
@@ -79,10 +75,8 @@ public class TestClassifierTypeTranslator
DependencyArtifactStubFactory factory = new DependencyArtifactStubFactory( null, false );
artifacts = factory.getMixedArtifacts();
- repoManager = lookup( RepositoryManager.class );
MavenSession session = newMavenSession( new MavenProjectStub() );
- buildingRequest = session.getProjectBuildingRequest();
DefaultRepositorySystemSession repoSession = (DefaultRepositorySystemSession) session.getRepositorySession();
repoSession.setLocalRepositoryManager( new SimpleLocalRepositoryManager( stubFactory.getWorkingDir() ) );
@@ -184,8 +178,7 @@ public class TestClassifierTypeTranslator
{
ArtifactCoordinate translatedArtifact = resultIter.next();
if ( artifact.getArtifactId() == translatedArtifact.getArtifactId()
- && artifact.getGroupId() == translatedArtifact.getGroupId()
- /* && artifact.getScope() == translatedArtifact.getScope() */ )
+ && artifact.getGroupId() == translatedArtifact.getGroupId() )
{
assertEquals( translatedArtifact.getClassifier(), classifier );
assertEquals( translatedArtifact.getExtension(), type );