Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
elharo committed Dec 14, 2024
1 parent 588e391 commit 43f8ba8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.io.File;

import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.project.MavenProject;

/**
* @author <a href="mailto:[email protected]">Maria Odea Ching</a>
Expand Down Expand Up @@ -88,15 +89,16 @@ public void testFailurePriority() throws Exception {
File testPom = new File(
getBasedir(),
"src/test/resources/unit/default-configuration/pmd-check-failonpriority-plugin-config.xml");
PmdViolationCheckMojo pmdViolationMojo = (PmdViolationCheckMojo) lookupMojo(getGoal(), testPom);
pmdViolationMojo.execute();
PmdViolationCheckMojo pmdViolationCheckMojo = (PmdViolationCheckMojo) lookupMojo(getGoal(), testPom);
pmdViolationCheckMojo.execute();

testPom = new File(
getBasedir(),
"src/test/resources/unit/default-configuration/pmd-check-failandwarnonpriority-plugin-config.xml");
pmdViolationMojo = (PmdViolationCheckMojo) lookupMojo(getGoal(), testPom);
pmdViolationCheckMojo = (PmdViolationCheckMojo) lookupMojo(getGoal(), testPom);

try {
pmdViolationMojo.execute();
pmdViolationCheckMojo.execute();
fail("Exception Expected");
} catch (final MojoFailureException e) {
assertTrue(e.getMessage()
Expand All @@ -111,11 +113,12 @@ public void testException() throws Exception {
getBasedir(),
"src/test/resources/unit/custom-configuration/pmd-check-exception-test-plugin-config.xml");
final PmdViolationCheckMojo mojo = (PmdViolationCheckMojo) lookupMojo(getGoal(), testPom);
mojo.project = new MavenProject();
mojo.execute();

fail("MojoFailureException should be thrown.");
} catch (final MojoFailureException e) {
assertTrue(true);
assertNotNull(e.getMessage());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,8 @@ under the License.
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<configuration>
<sourceDirectory>${basedir}/src/test/resources/unit/custom-configuration</sourceDirectory>
<targetDirectory>${basedir}/target/test/unit/custom-configuration/target</targetDirectory>
<rulesetsTargetDirectory>${basedir}/target/test/unit/custom-configuration/target/pmd/rulesets</rulesetsTargetDirectory>
<failOnViolation>false</failOnViolation>
<language>java</language>
</configuration>
</plugin>
</plugins>
Expand Down

0 comments on commit 43f8ba8

Please sign in to comment.