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-pmd-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new 77c7c6c  [MPMD-411] Implement getOutputPath and identify getOutputName 
as deprecated, (#179)
77c7c6c is described below

commit 77c7c6ca5d725318dd07551a359b60343f53b80d
Author: Elliotte Rusty Harold <elh...@users.noreply.github.com>
AuthorDate: Sun Dec 15 13:01:13 2024 +0000

    [MPMD-411] Implement getOutputPath and identify getOutputName as 
deprecated, (#179)
---
 src/main/java/org/apache/maven/plugins/pmd/CpdReport.java          | 7 +++++++
 src/main/java/org/apache/maven/plugins/pmd/PmdReport.java          | 6 ++++++
 .../org/apache/maven/plugins/pmd/AbstractPmdReportTestCase.java    | 2 +-
 src/test/java/org/apache/maven/plugins/pmd/CpdReportTest.java      | 4 +++-
 4 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugins/pmd/CpdReport.java 
b/src/main/java/org/apache/maven/plugins/pmd/CpdReport.java
index 3ba1b7d..4970628 100644
--- a/src/main/java/org/apache/maven/plugins/pmd/CpdReport.java
+++ b/src/main/java/org/apache/maven/plugins/pmd/CpdReport.java
@@ -210,7 +210,14 @@ public class CpdReport extends AbstractPmdReport {
     /**
      * {@inheritDoc}
      */
+    @Override
+    @Deprecated
     public String getOutputName() {
         return "cpd";
     }
+
+    @Override
+    public String getOutputPath() {
+        return "cpd";
+    }
 }
diff --git a/src/main/java/org/apache/maven/plugins/pmd/PmdReport.java 
b/src/main/java/org/apache/maven/plugins/pmd/PmdReport.java
index b3bf3e9..d5d2730 100644
--- a/src/main/java/org/apache/maven/plugins/pmd/PmdReport.java
+++ b/src/main/java/org/apache/maven/plugins/pmd/PmdReport.java
@@ -543,10 +543,16 @@ public class PmdReport extends AbstractPmdReport {
      * {@inheritDoc}
      */
     @Override
+    @Deprecated
     public String getOutputName() {
         return "pmd";
     }
 
+    @Override
+    public String getOutputPath() {
+        return "pmd";
+    }
+
     /**
      * Create and return the correct renderer for the output type.
      *
diff --git 
a/src/test/java/org/apache/maven/plugins/pmd/AbstractPmdReportTestCase.java 
b/src/test/java/org/apache/maven/plugins/pmd/AbstractPmdReportTestCase.java
index 3c4bfd3..8b4f5e8 100644
--- a/src/test/java/org/apache/maven/plugins/pmd/AbstractPmdReportTestCase.java
+++ b/src/test/java/org/apache/maven/plugins/pmd/AbstractPmdReportTestCase.java
@@ -141,7 +141,7 @@ public abstract class AbstractPmdReportTestCase extends 
AbstractMojoTestCase {
         testMavenProject = builder.build(pluginXmlFile, 
buildingRequest).getProject();
 
         File outputDir = mojo.getReportOutputDirectory();
-        String filename = mojo.getOutputName() + ".html";
+        String filename = mojo.getOutputPath() + ".html";
 
         return new File(outputDir, filename);
     }
diff --git a/src/test/java/org/apache/maven/plugins/pmd/CpdReportTest.java 
b/src/test/java/org/apache/maven/plugins/pmd/CpdReportTest.java
index 4d6ac98..a07e195 100644
--- a/src/test/java/org/apache/maven/plugins/pmd/CpdReportTest.java
+++ b/src/test/java/org/apache/maven/plugins/pmd/CpdReportTest.java
@@ -182,7 +182,9 @@ public class CpdReportTest extends 
AbstractPmdReportTestCase {
     public void testEmptyReportConfiguration() throws Exception {
         // verify the generated files do exist, even if there are no violations
         File generatedReport = generateReport(getGoal(), 
"empty-report/cpd-empty-report-plugin-config.xml");
-        assertTrue(new File(generatedReport.getAbsolutePath()).exists());
+        assertTrue(
+                generatedReport.getAbsolutePath() + " does not exist",
+                new File(generatedReport.getAbsolutePath()).exists());
 
         String str = readFile(generatedReport);
         assertFalse(lowerCaseContains(str, "Hello.java"));

Reply via email to