Skip to content

Commit

Permalink
Fix mismatching Parameter initial field values
Browse files Browse the repository at this point in the history
Field values should match `defaultValue` of `Parameter` annotation.
Had to adjust the unit tests because they were apparently manually
constructing the Mojos and therefore not using the `Parameter#defaultValue`.

Also removes the parameters from `TestUnpackDependenciesMojo#dotestArtifactExceptions`
because they were apparently unused since commit 809bfe1.
  • Loading branch information
Marcono1234 authored and slawekjaranowski committed Jul 2, 2024
1 parent 620f8fb commit c729702
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public abstract class AbstractFromDependenciesMojo extends AbstractDependencyFil
* @since 2.0-alpha-2
*/
@Parameter(property = "mdep.failOnMissingClassifierArtifact", defaultValue = "false")
protected boolean failOnMissingClassifierArtifact = true;
protected boolean failOnMissingClassifierArtifact;

/**
* @return Returns the outputDirectory.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public class CopyDependenciesMojo extends AbstractFromDependenciesMojo {
* @since 2.0
*/
@Parameter(property = "mdep.copyPom", defaultValue = "false")
protected boolean copyPom = true;
protected boolean copyPom;

@Component
private CopyUtil copyUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ public void testArtifactResolutionException() throws MojoFailureException {

public void dotestArtifactExceptions() throws MojoFailureException {
mojo.classifier = "jdk";
mojo.failOnMissingClassifierArtifact = true;
mojo.type = "java-sources";

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -491,16 +491,13 @@ public void dotestClassifierType(String testClassifier, String testType) throws
}
}

public void testArtifactNotFound() throws Exception {
dotestArtifactExceptions(false, true);
public void testArtifactResolutionException() throws MojoFailureException {
dotestArtifactExceptions();
}

public void testArtifactResolutionException() throws Exception {
dotestArtifactExceptions(true, false);
}

public void dotestArtifactExceptions(boolean are, boolean anfe) throws Exception {
public void dotestArtifactExceptions() throws MojoFailureException {
mojo.classifier = "jdk";
mojo.failOnMissingClassifierArtifact = true;
mojo.type = "java-sources";

try {
Expand Down

0 comments on commit c729702

Please sign in to comment.