You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2021/01/31 22:56:47 UTC

[maven-javadoc-plugin] branch next created (now 86fb593)

This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a change to branch next
in repository https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git.


      at 86fb593  Added Java 16 and 17 to Github Action tests

This branch includes the following new commits:

     new a26458e  Bump plexus-interactivity-api from 1.0-alpha-6 to 1.0
     new c393c9c  (doc) misc dependency updates in integration tests
     new 95f1cf9  Bump mockito-core from 2.23.4 to 2.28.2
     new 043d92e  Bump plexus-java from 1.0.5 to 1.0.6
     new 41f4e96  Replace dependency to junit-addons with direct reflection calls
     new 9d1aaa5  Tests improvements / AssertJ / Java 16+
     new 86fb593  Added Java 16 and 17 to Github Action tests

The 7 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[maven-javadoc-plugin] 07/07: Added Java 16 and 17 to Github Action tests

Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch next
in repository https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git

commit 86fb593abf75199e54e0e278108b6ffa803b239f
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Sun Jan 31 23:55:25 2021 +0100

    Added Java 16 and 17 to Github Action tests
---
 .github/workflows/maven.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index a8fa3ce..28267d8 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -25,7 +25,7 @@ jobs:
     strategy:
       matrix:
         os: [ubuntu-latest, windows-latest, macOS-latest]
-        java: [7, 8, 11, 15]
+        java: [7, 8, 11, 15, 16-ea, 17-ea]
       fail-fast: false
 
     runs-on: ${{ matrix.os }}


[maven-javadoc-plugin] 01/07: Bump plexus-interactivity-api from 1.0-alpha-6 to 1.0

Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch next
in repository https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git

commit a26458e92db04ab43c948c8e0a74b5277b35face
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Sun Jan 31 18:07:32 2021 +0100

    Bump plexus-interactivity-api from 1.0-alpha-6 to 1.0
---
 pom.xml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pom.xml b/pom.xml
index 471da3b..af0e37c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -296,15 +296,15 @@ under the License.
     <dependency>
       <groupId>org.codehaus.plexus</groupId>
       <artifactId>plexus-interactivity-api</artifactId>
-      <version>1.0-alpha-6</version>
+      <version>1.0</version>
       <exclusions>
         <exclusion>
-          <groupId>plexus</groupId>
+          <groupId>org.codehaus.plexus</groupId>
           <artifactId>plexus-utils</artifactId>
         </exclusion>
         <exclusion>
           <groupId>org.codehaus.plexus</groupId>
-          <artifactId>plexus-component-api</artifactId>
+          <artifactId>plexus-container-default</artifactId>
         </exclusion>
       </exclusions>
     </dependency>


[maven-javadoc-plugin] 03/07: Bump mockito-core from 2.23.4 to 2.28.2

Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch next
in repository https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git

commit 95f1cf92d41d57389feb381548949be6ba21df32
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Sun Jan 31 18:14:42 2021 +0100

    Bump mockito-core from 2.23.4 to 2.28.2
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index af0e37c..eb28331 100644
--- a/pom.xml
+++ b/pom.xml
@@ -343,7 +343,7 @@ under the License.
     <dependency>
       <groupId>org.mockito</groupId>
       <artifactId>mockito-core</artifactId>
-      <version>2.23.4</version>
+      <version>2.28.2</version>
       <scope>test</scope>
     </dependency>
     <dependency>


[maven-javadoc-plugin] 06/07: Tests improvements / AssertJ / Java 16+

Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch next
in repository https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git

commit 9d1aaa521955e578337ab3fed4f869b7074343e1
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Sun Jan 31 23:48:17 2021 +0100

    Tests improvements / AssertJ / Java 16+
---
 pom.xml                                            |  6 ++
 .../javadoc/AbstractFixJavadocMojoTest.java        | 48 ++++++++--------
 .../plugins/javadoc/AbstractJavadocMojoTest.java   | 36 ++++++------
 .../maven/plugins/javadoc/JavadocJarTest.java      | 35 +++++------
 .../maven/plugins/javadoc/JavadocReportTest.java   | 55 ++++++++++--------
 .../maven/plugins/javadoc/JavadocUtilTest.java     | 67 ++++++++--------------
 .../maven/plugins/javadoc/JavadocVersionTest.java  | 41 ++++++-------
 .../plugins/javadoc/TestJavadocReportTest.java     |  6 +-
 .../io/xpp3/JavadocOptionsXpp3ReaderTest.java      | 16 +++---
 .../def/configuration/App.java                     |  3 +
 .../def/configuration/AppSample.java               |  2 +-
 11 files changed, 155 insertions(+), 160 deletions(-)

diff --git a/pom.xml b/pom.xml
index 5cb55f9..37af96f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -352,6 +352,12 @@ under the License.
       <classifier>shaded</classifier>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.assertj</groupId>
+      <artifactId>assertj-core</artifactId>
+      <version>2.9.1</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>
diff --git a/src/test/java/org/apache/maven/plugins/javadoc/AbstractFixJavadocMojoTest.java b/src/test/java/org/apache/maven/plugins/javadoc/AbstractFixJavadocMojoTest.java
index 049d57a..54c5dc6 100644
--- a/src/test/java/org/apache/maven/plugins/javadoc/AbstractFixJavadocMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/javadoc/AbstractFixJavadocMojoTest.java
@@ -25,18 +25,19 @@ import com.thoughtworks.qdox.JavaProjectBuilder;
 import com.thoughtworks.qdox.model.JavaClass;
 import com.thoughtworks.qdox.model.JavaSource;
 
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
 
 public class AbstractFixJavadocMojoTest
-    extends TestCase
 {
     private JavaSource getJavaSource( String source )
     {
         return new JavaProjectBuilder().addSource( new StringReader( source ) );
     }
 
+    @Test
     public void testReplaceLinkTags_noLinkTag()
-        throws Throwable
     {
         String comment = "/** @see ConnectException */";
         String source = "import java.net.ConnectException;\n"
@@ -46,12 +47,12 @@ public class AbstractFixJavadocMojoTest
         JavaClass clazz = getJavaSource( source ).getClassByName( "NoLinkTag" );
 
         String newComment = AbstractFixJavadocMojo.replaceLinkTags( comment, clazz );
-            
-        assertEquals( "/** @see ConnectException */", newComment );
+
+        assertThat( newComment ).isEqualTo( "/** @see ConnectException */" );
     }
 
+    @Test
     public void testReplaceLinkTags_oneLinkTag()
-        throws Throwable
     {
         String comment = "/** {@link ConnectException} */";
         String source = "import java.net.ConnectException;\n"
@@ -61,11 +62,11 @@ public class AbstractFixJavadocMojoTest
         JavaClass clazz = getJavaSource( source ).getClassByName( "OneLinkTag" );
 
         String newComment = AbstractFixJavadocMojo.replaceLinkTags( comment, clazz );
-        assertEquals( "/** {@link java.net.ConnectException} */", newComment );
+        assertThat( newComment ).isEqualTo( "/** {@link java.net.ConnectException} */" );
     }
 
+    @Test
     public void testReplaceLinkTags_missingEndBrace()
-        throws Throwable
     {
         String comment = "/** {@link ConnectException */";
         String source = "import java.net.ConnectException;\n"
@@ -75,11 +76,11 @@ public class AbstractFixJavadocMojoTest
         JavaClass clazz = getJavaSource( source ).getClassByName( "MissingEndBrace" );
                     
         String newComment = AbstractFixJavadocMojo.replaceLinkTags( comment, clazz );
-        assertEquals( "/** {@link ConnectException */", newComment );
+        assertThat( newComment ).isEqualTo( "/** {@link ConnectException */" );
     }
 
+    @Test
     public void testReplaceLinkTags_spacesAfterLinkTag()
-        throws Throwable
     {
         String comment = "/** {@link     ConnectException} */";
         String source = "import java.net.ConnectException;\n"
@@ -89,11 +90,11 @@ public class AbstractFixJavadocMojoTest
         JavaClass clazz = getJavaSource( source ).getClassByName( "SpacesAfterLinkTag" );
         
         String newComment = AbstractFixJavadocMojo.replaceLinkTags( comment, clazz );
-        assertEquals( "/** {@link java.net.ConnectException} */", newComment );
+        assertThat( newComment ).isEqualTo( "/** {@link java.net.ConnectException} */" );
     }
 
+    @Test
     public void testReplaceLinkTags_spacesAfterClassName()
-        throws Throwable
     {
         String comment = "/** {@link ConnectException       } */";
         String source = "import java.net.ConnectException;\n"
@@ -103,11 +104,11 @@ public class AbstractFixJavadocMojoTest
         JavaClass clazz = getJavaSource( source ).getClassByName( "SpacesAfterClassName" );
         
         String newComment = AbstractFixJavadocMojo.replaceLinkTags( comment, clazz );
-        assertEquals( "/** {@link java.net.ConnectException} */", newComment );
+        assertThat( newComment ).isEqualTo( "/** {@link java.net.ConnectException} */" );
     }
 
+    @Test
     public void testReplaceLinkTags_spacesAfterMethod()
-        throws Throwable
     {
         String comment = "/** {@link ConnectException#getMessage()       } */";
         String source = "import java.net.ConnectException;\n"
@@ -117,11 +118,11 @@ public class AbstractFixJavadocMojoTest
         JavaClass clazz = getJavaSource( source ).getClassByName( "SpacesAfterMethod" );
 
         String newComment = AbstractFixJavadocMojo.replaceLinkTags( comment, clazz );
-        assertEquals( "/** {@link java.net.ConnectException#getMessage()} */", newComment );
+        assertThat( newComment ).isEqualTo( "/** {@link java.net.ConnectException#getMessage()} */" );
     }
 
+    @Test
     public void testReplaceLinkTags_containingHash()
-        throws Throwable
     {
         String comment = "/** {@link ConnectException#getMessage()} */";
         String source = "import java.net.ConnectException;\n"
@@ -131,11 +132,11 @@ public class AbstractFixJavadocMojoTest
         JavaClass clazz = getJavaSource( source ).getClassByName( "ContainingHashes" );
 
         String newComment = AbstractFixJavadocMojo.replaceLinkTags( comment, clazz );
-        assertEquals( "/** {@link java.net.ConnectException#getMessage()} */", newComment );
+        assertThat( newComment ).isEqualTo( "/** {@link java.net.ConnectException#getMessage()} */" );
     }
 
+    @Test
     public void testReplaceLinkTags_followedByHash()
-        throws Throwable
     {
         String comment = "/** {@link ConnectException} ##important## */";
         String source = "import java.net.ConnectException;\n"
@@ -145,11 +146,11 @@ public class AbstractFixJavadocMojoTest
         JavaClass clazz = getJavaSource( source ).getClassByName( "FollowedByHash" );
 
         String newComment = AbstractFixJavadocMojo.replaceLinkTags( comment, clazz );
-        assertEquals( "/** {@link java.net.ConnectException} ##important## */", newComment );
+        assertThat( newComment ).isEqualTo( "/** {@link java.net.ConnectException} ##important## */" );
     }
 
+    @Test
     public void testReplaceLinkTags_twoLinks()
-        throws Throwable
     {
         String comment = "/** Use {@link ConnectException} instead of {@link Exception} */";
         String source = "import java.net.ConnectException;\n"
@@ -159,11 +160,12 @@ public class AbstractFixJavadocMojoTest
         JavaClass clazz = getJavaSource( source ).getClassByName( "TwoLinks" );
 
         String newComment = AbstractFixJavadocMojo.replaceLinkTags( comment, clazz );
-        assertEquals( "/** Use {@link java.net.ConnectException} instead of {@link java.lang.Exception} */", newComment );
+        assertThat( newComment ).isEqualTo(
+                "/** Use {@link java.net.ConnectException} instead of {@link java.lang.Exception} */" );
     }
 
+    @Test
     public void testReplaceLinkTags_OnlyAnchor()
-        throws Throwable
     {
         String comment = "/** There's a {@link #getClass()} but no setClass() */";
         String source = "import java.net.ConnectException;\n"
@@ -173,6 +175,6 @@ public class AbstractFixJavadocMojoTest
         JavaClass clazz = getJavaSource( source ).getClassByName( "OnlyAnchor" );
 
         String newComment = AbstractFixJavadocMojo.replaceLinkTags( comment, clazz );
-        assertEquals( "/** There's a {@link #getClass()} but no setClass() */", newComment );
+        assertThat( newComment ).isEqualTo( "/** There's a {@link #getClass()} but no setClass() */" );
     }
 }
diff --git a/src/test/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojoTest.java b/src/test/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojoTest.java
index 1432492..7804611 100644
--- a/src/test/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojoTest.java
@@ -19,7 +19,8 @@ package org.apache.maven.plugins.javadoc;
  * under the License.
  */
 
-import static org.mockito.Matchers.anyString;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.ArgumentMatchers.anyString;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.times;
@@ -28,33 +29,28 @@ import static org.mockito.Mockito.when;
 
 import java.io.File;
 
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.plugin.logging.Log;
-import org.apache.maven.plugins.javadoc.AbstractJavadocMojo;
 
-import junit.framework.TestCase;
+import org.junit.Before;
+import org.junit.Test;
 
 public class AbstractJavadocMojoTest
-    extends TestCase
 {
     AbstractJavadocMojo mojo;
 
-    @Override
-    protected void setUp()
-        throws Exception
+    @Before
+    public void setUp()
     {
-        super.setUp();
         mojo = new AbstractJavadocMojo()
         {
             @Override
             public void doExecute()
-                throws MojoExecutionException, MojoFailureException
             {
             }
         };
     }
 
+    @Test
     public void testMJAVADOC432_DetectLinksMessages()
     {
         Log log = mock( Log.class );
@@ -63,20 +59,21 @@ public class AbstractJavadocMojoTest
         mojo.outputDirectory = new File( "target/test-classes" );
 
         // first continues after warning, next exits with warning
-        assertFalse( mojo.isValidJavadocLink( new File( "pom.xml" ).getPath(), true ) );
-        assertFalse( mojo.isValidJavadocLink( "file://%%", true ) );
-        assertFalse( mojo.isValidJavadocLink( new File( "pom.xml" ).toURI().toString(), true ) );
+        assertThat( mojo.isValidJavadocLink( new File( "pom.xml" ).getPath(), true ) ).isFalse();
+        assertThat( mojo.isValidJavadocLink( "file://%%", true ) ).isFalse();
+        assertThat( mojo.isValidJavadocLink( new File( "pom.xml" ).toURI().toString(), true ) ).isFalse();
         verify( log, times( 4 ) ).warn( anyString() );
         verify( log, never() ).error( anyString() );
 
         // first continues after error, next exits with error
-        assertFalse( mojo.isValidJavadocLink( new File( "pom.xml" ).getPath(), false ) );
-        assertFalse( mojo.isValidJavadocLink( "file://%%", false ) );
-        assertFalse( mojo.isValidJavadocLink( new File( "pom.xml" ).toURI().toString(), false ) );
+        assertThat( mojo.isValidJavadocLink( new File( "pom.xml" ).getPath(), false ) ).isFalse();
+        assertThat( mojo.isValidJavadocLink( "file://%%", false ) ).isFalse();
+        assertThat( mojo.isValidJavadocLink( new File( "pom.xml" ).toURI().toString(), false ) ).isFalse();
         verify( log, times( 4 ) ).error( anyString() );
         verify( log, times( 4 ) ).warn( anyString() ); // no extra warnings
     }
 
+    @Test
     public void testMJAVADOC527_DetectLinksRecursion()
     {
         Log log = mock( Log.class );
@@ -84,7 +81,8 @@ public class AbstractJavadocMojoTest
         mojo.setLog( log );
         mojo.outputDirectory = new File( "target/test-classes" );
 
-        assertFalse( mojo.isValidJavadocLink( "http://javamail.java.net/mailapi/apidocs", false ) );
-        assertTrue( mojo.isValidJavadocLink( "http://commons.apache.org/proper/commons-lang/apidocs", false ) );
+        assertThat( mojo.isValidJavadocLink( "http://javamail.java.net/mailapi/apidocs", false ) ).isFalse();
+        assertThat(
+                mojo.isValidJavadocLink( "http://commons.apache.org/proper/commons-lang/apidocs", false ) ).isTrue();
     }
 }
diff --git a/src/test/java/org/apache/maven/plugins/javadoc/JavadocJarTest.java b/src/test/java/org/apache/maven/plugins/javadoc/JavadocJarTest.java
index 900851c..eb46b6c 100644
--- a/src/test/java/org/apache/maven/plugins/javadoc/JavadocJarTest.java
+++ b/src/test/java/org/apache/maven/plugins/javadoc/JavadocJarTest.java
@@ -21,10 +21,8 @@ package org.apache.maven.plugins.javadoc;
 
 
 import java.io.File;
-import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.HashSet;
-import java.util.List;
 import java.util.Set;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
@@ -35,7 +33,8 @@ import org.apache.maven.plugin.testing.AbstractMojoTestCase;
 import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.languages.java.version.JavaVersion;
-import org.codehaus.plexus.util.FileUtils;
+
+import static org.assertj.core.api.Assertions.assertThat;
 
 /**
  * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
@@ -79,7 +78,7 @@ public class JavadocJarTest
         //check if the javadoc jar file was generated
         File generatedFile =
             new File( getBasedir(), "target/test/unit/javadocjar-default/target/javadocjar-default-javadoc.jar" );
-        assertTrue( FileUtils.fileExists( generatedFile.getAbsolutePath() ) );
+        assertThat( generatedFile ).exists();
 
         Set<String> set = new HashSet<>();
 
@@ -131,11 +130,11 @@ public class JavadocJarTest
         //check if the javadoc files were created
         generatedFile =
             new File( getBasedir(), "target/test/unit/javadocjar-default/target/site/apidocs/javadocjar/def/App.html" );
-        assertTrue( FileUtils.fileExists( generatedFile.getAbsolutePath() ) );
+        assertThat(generatedFile).exists();
 
         generatedFile = new File( getBasedir(),
                                   "target/test/unit/javadocjar-default/target/site/apidocs/javadocjar/def/AppSample.html" );
-        assertTrue( FileUtils.fileExists( generatedFile.getAbsolutePath() ) );
+        assertThat( generatedFile ).exists();
     }
 
     /**
@@ -154,7 +153,7 @@ public class JavadocJarTest
         //check if the javadoc jar file was generated
         File generatedFile = new File( getBasedir(),
                                        "target/test/unit/javadocjar-invalid-destdir/target/javadocjar-invalid-destdir-javadoc.jar" );
-        assertFalse( FileUtils.fileExists( generatedFile.getAbsolutePath() ) );
+        assertThat( generatedFile ).doesNotExist();
     }
 
     public void testContinueIfFailOnErrorIsFalse() throws Exception
@@ -167,7 +166,7 @@ public class JavadocJarTest
         //check if the javadoc jar file was generated
         File generatedFile =
                 new File( getBasedir(), "target/test/unit/javadocjar-failonerror/target/javadocjar-failonerror-javadoc.jar" );
-        assertTrue( FileUtils.fileExists( generatedFile.getAbsolutePath() ) );
+        assertThat( generatedFile ).exists();
     }
 
     public void testIncludeMavenDescriptorWhenExplicitlyConfigured() throws Exception
@@ -180,7 +179,7 @@ public class JavadocJarTest
         //check if the javadoc jar file was generated
         File generatedFile =
                 new File( getBasedir(), "target/test/unit/javadocjar-archive-config/target/javadocjar-archive-config-javadoc.jar" );
-        assertTrue( FileUtils.fileExists( generatedFile.getAbsolutePath() ) );
+        assertThat( generatedFile ).exists();
 
         //validate contents of jar file
         ZipFile jar = new ZipFile( generatedFile );
@@ -192,16 +191,12 @@ public class JavadocJarTest
         }
         jar.close();
 
-        List<String> expected = new ArrayList<>();
-        expected.add( "META-INF/" );
-        expected.add( "META-INF/maven/" );
-        expected.add( "META-INF/maven/org.apache.maven.plugins.maven-javadoc-plugin.unit/" );
-        expected.add( "META-INF/maven/org.apache.maven.plugins.maven-javadoc-plugin.unit/javadocjar-archive-config/" );
-        expected.add( "META-INF/maven/org.apache.maven.plugins.maven-javadoc-plugin.unit/javadocjar-archive-config/pom.xml" );
-        expected.add( "META-INF/maven/org.apache.maven.plugins.maven-javadoc-plugin.unit/javadocjar-archive-config/pom.properties" );
-
-        for (String entry : expected) {
-            assertTrue("Expected jar to contain " + entry, set.contains(entry));
-        }
+        assertThat( set ).contains(
+                "META-INF/",
+                "META-INF/maven/",
+                "META-INF/maven/org.apache.maven.plugins.maven-javadoc-plugin.unit/",
+                "META-INF/maven/org.apache.maven.plugins.maven-javadoc-plugin.unit/javadocjar-archive-config/",
+                "META-INF/maven/org.apache.maven.plugins.maven-javadoc-plugin.unit/javadocjar-archive-config/pom.xml",
+                "META-INF/maven/org.apache.maven.plugins.maven-javadoc-plugin.unit/javadocjar-archive-config/pom.properties" );
     }
 }
diff --git a/src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java b/src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java
index 393e66e..bc6e2e2 100644
--- a/src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java
+++ b/src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java
@@ -19,7 +19,7 @@ package org.apache.maven.plugins.javadoc;
  * under the License.
  */
 
-import static org.junit.Assert.assertThat;
+import static org.assertj.core.api.Assertions.assertThat;
 import static org.junit.Assume.assumeThat;
 import static org.hamcrest.CoreMatchers.anyOf;
 import static org.hamcrest.CoreMatchers.containsString;
@@ -36,6 +36,7 @@ import java.net.URL;
 import java.nio.charset.Charset;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
+import java.nio.file.Path;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -56,6 +57,7 @@ import org.apache.maven.settings.Settings;
 import org.codehaus.plexus.languages.java.version.JavaVersion;
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.StringUtils;
+import org.hamcrest.MatcherAssert;
 import org.junit.AssumptionViolatedException;
 import org.junit.Ignore;
 import org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager;
@@ -243,11 +245,11 @@ public class JavadocReportTest
         mojo.execute();
 
         // package level generated javadoc files
-        File apidocs = new File( getBasedir(), "target/test/unit/default-configuration/target/site/apidocs" );
+        Path apidocs = new File( getBasedir(), "target/test/unit/default-configuration/target/site/apidocs" ).toPath();
 
         String appHtml = "def/configuration/App.html";
-        File generatedFile = new File( apidocs, appHtml );
-        assertTrue( generatedFile.exists() );
+        Path generatedFile = apidocs.resolve( appHtml );
+        assertThat( generatedFile ).exists();
 
         // only test when URL can be reached
 
@@ -261,8 +263,8 @@ public class JavadocReportTest
                 assumeThat( connection.getURL().toString(), is( url ) );
 
                 // https://bugs.openjdk.java.net/browse/JDK-8216497
-                assertThat( url + " available, but " + appHtml + " is missing link to java.lang.Object",
-                            FileUtils.fileRead( generatedFile, "UTF-8" ),
+                MatcherAssert.assertThat( url + " available, but " + appHtml + " is missing link to java.lang.Object",
+                            FileUtils.fileRead( generatedFile.toFile(), "UTF-8" ),
                             anyOf( containsString( "/docs/api/java/lang/Object.html" ), 
                             containsString( "/docs/api/java.base/java/lang/Object.html" ) ) );
             }
@@ -272,39 +274,39 @@ public class JavadocReportTest
             }
         }
 
-        assertTrue( new File( apidocs, "def/configuration/AppSample.html" ).exists() );
-        assertTrue( new File( apidocs, "def/configuration/package-summary.html" ).exists() );
-        assertTrue( new File( apidocs, "def/configuration/package-tree.html" ).exists() );
-        assertTrue( new File( apidocs, "def/configuration/package-use.html" ).exists() );
+        assertThat( apidocs.resolve( "def/configuration/AppSample.html" )).exists();
+        assertThat( apidocs.resolve( "def/configuration/package-summary.html" )).exists();
+        assertThat( apidocs.resolve( "def/configuration/package-tree.html" )).exists();
+        assertThat( apidocs.resolve( "def/configuration/package-use.html" )).exists();
 
         // package-frame and allclasses-(no)frame not generated anymore since Java 11
         if ( JavaVersion.JAVA_SPECIFICATION_VERSION.isBefore( "11" ) )
         {
-            assertTrue( new File( apidocs, "def/configuration/package-frame.html" ).exists() );
-            assertTrue( new File( apidocs, "allclasses-frame.html" ).exists() );
-            assertTrue( new File( apidocs, "allclasses-noframe.html" ).exists() );
+            assertThat( apidocs.resolve( "def/configuration/package-frame.html" )).exists();;
+            assertThat( apidocs.resolve( "allclasses-frame.html" )).exists();
+            assertThat( apidocs.resolve( "allclasses-noframe.html" )).exists();
         }
 
         // class level generated javadoc files
-        assertTrue( new File( apidocs, "def/configuration/class-use/App.html" ).exists() );
-        assertTrue( new File( apidocs, "def/configuration/class-use/AppSample.html" ).exists() );
+        assertThat( apidocs.resolve( "def/configuration/class-use/App.html" )).exists();
+        assertThat( apidocs.resolve( "def/configuration/class-use/AppSample.html" )).exists();
 
         // project level generated javadoc files
-        assertTrue( new File( apidocs, "constant-values.html" ).exists() );
-        assertTrue( new File( apidocs, "deprecated-list.html" ).exists() );
-        assertTrue( new File( apidocs, "help-doc.html" ).exists() );
-        assertTrue( new File( apidocs, "index-all.html" ).exists() );
-        assertTrue( new File( apidocs, "index.html" ).exists() );
-        assertTrue( new File( apidocs, "overview-tree.html" ).exists() );
-        assertTrue( new File( apidocs, "stylesheet.css" ).exists() );
+        assertThat( apidocs.resolve( "constant-values.html" )).exists();
+        assertThat( apidocs.resolve( "deprecated-list.html" ) ).exists();
+        assertThat( apidocs.resolve( "help-doc.html" )).exists();
+        assertThat( apidocs.resolve( "index-all.html" )).exists();
+        assertThat( apidocs.resolve( "index.html" )).exists();
+        assertThat( apidocs.resolve( "overview-tree.html" )).exists();
+        assertThat( apidocs.resolve( "stylesheet.css" )).exists();
 
         if ( JavaVersion.JAVA_VERSION.isAtLeast( "10" ) )
         {
-            assertTrue( new File( apidocs, "element-list" ).exists() );
+            assertThat( apidocs.resolve( "element-list" )).exists();
         }
         else
         {
-            assertTrue( new File( apidocs, "package-list" ).exists() );
+            assertThat( apidocs.resolve( "package-list" )).exists();
         }
     }
 
@@ -433,7 +435,10 @@ public class JavadocReportTest
         assertTrue( str.toUpperCase().contains( "MAVEN JAVADOC PLUGIN TEST" ) );
 
         // footer
-        assertTrue( str.toUpperCase().contains( "MAVEN JAVADOC PLUGIN TEST FOOTER" ) );
+        if ( JavaVersion.JAVA_VERSION.isBefore( "16" ) )
+        {
+            assertTrue( str.toUpperCase().contains( "MAVEN JAVADOC PLUGIN TEST FOOTER" ) );
+        }
 
         // nohelp == true
         assertFalse( str.toUpperCase().contains( "/HELP-DOC.HTML" ) );
diff --git a/src/test/java/org/apache/maven/plugins/javadoc/JavadocUtilTest.java b/src/test/java/org/apache/maven/plugins/javadoc/JavadocUtilTest.java
index e3a00d1..17ccae0 100644
--- a/src/test/java/org/apache/maven/plugins/javadoc/JavadocUtilTest.java
+++ b/src/test/java/org/apache/maven/plugins/javadoc/JavadocUtilTest.java
@@ -1,7 +1,5 @@
 package org.apache.maven.plugins.javadoc;
 
-import static org.junit.Assert.assertArrayEquals;
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -43,7 +41,6 @@ import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.commons.lang3.builder.EqualsBuilder;
 import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
 import org.apache.maven.plugins.javadoc.ProxyServer.AuthAsyncProxyServlet;
 import org.apache.maven.settings.Proxy;
@@ -55,6 +52,8 @@ import org.mortbay.jetty.handler.AbstractHandler;
 import org.mortbay.jetty.handler.MovedContextHandler;
 import org.mortbay.util.ByteArrayISO8859Writer;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 /**
  * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
  */
@@ -622,7 +621,7 @@ public class JavadocUtilTest
         throws Exception
     {
         File input = new File( getBasedir(), "src/test/resources/unit/docfiles-test/docfiles/" );
-        assertTrue( input.exists() );
+        assertThat( input ).exists();
 
         File output = new File( getBasedir(), "target/test/unit/docfiles-test/target/output" );
         if ( output.exists() )
@@ -632,26 +631,17 @@ public class JavadocUtilTest
         assertTrue( output.mkdirs() );
 
         JavadocUtil.copyJavadocResources( output, input, null );
-        List<String> expected = new ArrayList<>();
-        expected.add( "test" + File.separator + "doc-files" + File.separator + "excluded-dir1" + File.separator
-            + "sample-excluded1.gif" );
-        expected.add( "test" + File.separator + "doc-files" + File.separator + "excluded-dir2" + File.separator
-            + "sample-excluded2.gif" );
-        expected.add( "test" + File.separator + "doc-files" + File.separator + "included-dir1" + File.separator
-            + "sample-included1.gif" );
-        expected.add( "test" + File.separator + "doc-files" + File.separator + "included-dir2" + File.separator
-            + "sample-included2.gif" );
-        assertTrue( EqualsBuilder.reflectionEquals( expected, FileUtils.getFiles( output, null, null, false ) ) );
-        expected = new ArrayList<>();
-        expected.add( "" );
-        expected.add( "test" + File.separator + "doc-files" + File.separator + "excluded-dir1" );
-        expected.add( "test" + File.separator + "doc-files" + File.separator + "excluded-dir1" );
-        expected.add( "test" + File.separator + "doc-files" + File.separator + "included-dir1" );
-        expected.add( "test" + File.separator + "doc-files" + File.separator + "included-dir2" );
-        assertTrue( EqualsBuilder.reflectionEquals( expected,
-                                                    FileUtils.getDirectoryNames( new File( output,
-                                                                                           "test/doc-files" ),
-                                                                                 null, null, false ) ) );
+
+        assertThat( FileUtils.getFiles( output, null, null, false ) )
+                .containsExactlyInAnyOrder(
+                    Paths.get( "test", "doc-files", "excluded-dir1", "sample-excluded1.gif" ).toFile(),
+                    Paths.get( "test", "doc-files", "excluded-dir2", "sample-excluded2.gif" ).toFile(),
+                    Paths.get( "test", "doc-files", "included-dir1", "sample-included1.gif" ).toFile(),
+                    Paths.get( "test", "doc-files", "included-dir2", "sample-included2.gif" ).toFile()
+        );
+
+        assertThat( FileUtils.getDirectoryNames( new File( output, "test/doc-files" ), null, null, false ) )
+                .containsExactlyInAnyOrder( "", "excluded-dir1", "excluded-dir2", "included-dir1", "included-dir2" );
 
         input = new File( getBasedir(), "src/test/resources/unit/docfiles-test/docfiles/" );
         assertTrue( input.exists() );
@@ -664,20 +654,15 @@ public class JavadocUtilTest
         assertTrue( output.mkdirs() );
 
         JavadocUtil.copyJavadocResources( output, input, "excluded-dir1:excluded-dir2" );
-        expected = new ArrayList<>();
-        expected.add( "test" + File.separator + "doc-files" + File.separator + "included-dir1" + File.separator
-            + "sample-included1.gif" );
-        expected.add( "test" + File.separator + "doc-files" + File.separator + "included-dir2" + File.separator
-            + "sample-included2.gif" );
-        assertTrue( EqualsBuilder.reflectionEquals( expected, FileUtils.getFiles( output, null, null, false ) ) );
-        expected = new ArrayList<>();
-        expected.add( "" );
-        expected.add( "test" + File.separator + "doc-files" + File.separator + "included-dir1" );
-        expected.add( "test" + File.separator + "doc-files" + File.separator + "included-dir2" );
-        assertTrue( EqualsBuilder.reflectionEquals( expected,
-                                                    FileUtils.getDirectoryNames( new File( output,
-                                                                                           "test/doc-files" ),
-                                                                                 null, null, false ) ) );
+
+        assertThat( FileUtils.getFiles( output, null, null, false ) )
+                .containsExactlyInAnyOrder(
+                    Paths.get( "test", "doc-files", "included-dir1", "sample-included1.gif" ).toFile(),
+                    Paths.get( "test", "doc-files", "included-dir2", "sample-included2.gif" ).toFile()
+                );
+
+        assertThat( FileUtils.getDirectoryNames( new File( output, "test/doc-files" ), null, null, false ) )
+                .containsExactlyInAnyOrder( "", "included-dir1", "included-dir2" );
     }
 
     /**
@@ -704,10 +689,8 @@ public class JavadocUtilTest
     /**
      * Method to test unifyPathSeparator()
      *
-     * @throws Exception if any
      */
     public void testUnifyPathSeparator()
-        throws Exception
     {
         assertNull( JavadocUtil.unifyPathSeparator( null ) );
 
@@ -736,7 +719,7 @@ public class JavadocUtilTest
     }
     
     
-    public void testGetIncludedFiles() throws Exception
+    public void testGetIncludedFiles()
     {
         File sourceDirectory = new File("target/it").getAbsoluteFile();
         String[] fileList = new String[] { "Main.java" };
@@ -744,7 +727,7 @@ public class JavadocUtilTest
         
         List<String> includedFiles = JavadocUtil.getIncludedFiles( sourceDirectory, fileList, excludePackages );
         
-        assertArrayEquals( fileList, includedFiles.toArray( new String[0] ) );
+        assertThat( includedFiles.toArray( new String[0] ) ).isEqualTo( fileList );
     }
 
     private void stopSilently( Server server )
diff --git a/src/test/java/org/apache/maven/plugins/javadoc/JavadocVersionTest.java b/src/test/java/org/apache/maven/plugins/javadoc/JavadocVersionTest.java
index 0f0bc23..ac63c24 100644
--- a/src/test/java/org/apache/maven/plugins/javadoc/JavadocVersionTest.java
+++ b/src/test/java/org/apache/maven/plugins/javadoc/JavadocVersionTest.java
@@ -19,50 +19,51 @@ package org.apache.maven.plugins.javadoc;
  * under the License.
  */
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 import org.junit.Test;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 public class JavadocVersionTest
 {
     /**
      * Parsing is lazy, only triggered when comparing
      * 
-     * @throws Exception
+     * @noinspection deprecation
      */
     @Test
-    public void testParse() throws Exception
+    public void testParse()
     {
-        assertTrue( JavadocVersion.parse( "1.4" ).compareTo( JavadocVersion.parse( "1.4.2" ) ) < 0 );
-        assertTrue( JavadocVersion.parse( "1.4" ).compareTo( JavadocVersion.parse( "1.5" ) ) < 0 );
-        assertTrue( JavadocVersion.parse( "1.8" ).compareTo( JavadocVersion.parse( "9" ) ) < 0 );
+        assertThat( JavadocVersion.parse( "1.4" ) )
+                .isLessThan( JavadocVersion.parse( "1.4.2" ) )
+                .isLessThan( JavadocVersion.parse( "1.5" ) );
+
+        assertThat( JavadocVersion.parse( "1.8" ) ).isLessThan( JavadocVersion.parse( "9" ) );
 
-        assertEquals( 0, JavadocVersion.parse( "1.4" ).compareTo( JavadocVersion.parse( "1.4" ) ) );
-        assertEquals( 0, JavadocVersion.parse( "1.4.2" ).compareTo( JavadocVersion.parse( "1.4.2" ) ) );
-        assertEquals( 0, JavadocVersion.parse( "9" ).compareTo( JavadocVersion.parse( "9" ) ) );
+        assertThat( JavadocVersion.parse( "1.4" ) ).isEqualByComparingTo( JavadocVersion.parse( "1.4" ) );
+        assertThat( JavadocVersion.parse( "1.4.2" ) ).isEqualByComparingTo( JavadocVersion.parse( "1.4.2" ) );
+        assertThat( JavadocVersion.parse( "9" ) ).isEqualByComparingTo( JavadocVersion.parse( "9" ) );
 
-        assertTrue( JavadocVersion.parse( "1.4.2" ).compareTo( JavadocVersion.parse( "1.4" ) ) > 0 );
-        assertTrue( JavadocVersion.parse( "1.5" ).compareTo( JavadocVersion.parse( "1.4" ) ) > 0 );
-        assertTrue( JavadocVersion.parse( "9" ).compareTo( JavadocVersion.parse( "1.8" ) ) > 0 );
+        assertThat( JavadocVersion.parse( "1.4.2" ) ).isGreaterThan( JavadocVersion.parse( "1.4" ) );
+        assertThat( JavadocVersion.parse( "1.5" ) ).isGreaterThan( JavadocVersion.parse( "1.4" ) );
+        assertThat( JavadocVersion.parse( "9" ) ).isGreaterThan( JavadocVersion.parse( "1.8" ) );
     }
     
     @Test
     public void testApiVersion() {
         Pattern p = Pattern.compile( "(1\\.\\d|\\d\\d*)" );
         Matcher m = p.matcher( "9" );
-        assertTrue(m.find());
-        assertEquals( "9", m.group( 1 ));
+        assertThat( m.find() ).isTrue();
+        assertThat( m.group( 1 ) ).isEqualTo( "9" );
 
         m = p.matcher( "1.4" );
-        assertTrue(m.find());
-        assertEquals( "1.4", m.group( 1 ));
+        assertThat( m.find() ).isTrue();
+        assertThat( m.group( 1 ) ).isEqualTo( "1.4" );
 
         m = p.matcher( "1.4.2" );
-        assertTrue(m.find());
-        assertEquals( "1.4", m.group( 1 ));
+        assertThat( m.find() ).isTrue();
+        assertThat( m.group( 1 ) ).isEqualTo( "1.4" );
     }
 }
diff --git a/src/test/java/org/apache/maven/plugins/javadoc/TestJavadocReportTest.java b/src/test/java/org/apache/maven/plugins/javadoc/TestJavadocReportTest.java
index 7ada0da..450db32 100644
--- a/src/test/java/org/apache/maven/plugins/javadoc/TestJavadocReportTest.java
+++ b/src/test/java/org/apache/maven/plugins/javadoc/TestJavadocReportTest.java
@@ -28,6 +28,8 @@ import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.util.FileUtils;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 /**
  * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
  */
@@ -61,9 +63,9 @@ public class TestJavadocReportTest
 
         File generatedFile =
             new File( getBasedir(), "target/test/unit/test-javadoc-test/target/site/apidocs/maven/AppTest.html" );
-        assertTrue( FileUtils.fileExists( generatedFile.getAbsolutePath() ) );
+        assertThat( generatedFile ).exists();
         
         File options = new File( getBasedir(), "target/test/unit/test-javadoc-test/target/site/apidocs/options");
-        FileUtils.fileRead( options ).contains( "junit-3.8.1.jar" );
+        assertThat( FileUtils.fileRead( options ) ).contains( "junit-3.8.1.jar" );
     }
 }
diff --git a/src/test/java/org/apache/maven/plugins/javadoc/options/io/xpp3/JavadocOptionsXpp3ReaderTest.java b/src/test/java/org/apache/maven/plugins/javadoc/options/io/xpp3/JavadocOptionsXpp3ReaderTest.java
index 1966492..118b26a 100644
--- a/src/test/java/org/apache/maven/plugins/javadoc/options/io/xpp3/JavadocOptionsXpp3ReaderTest.java
+++ b/src/test/java/org/apache/maven/plugins/javadoc/options/io/xpp3/JavadocOptionsXpp3ReaderTest.java
@@ -19,14 +19,14 @@ package org.apache.maven.plugins.javadoc.options.io.xpp3;
  * under the License.
  */
 
-import static org.junit.Assert.assertEquals;
-
 import java.io.StringReader;
 
 import org.apache.maven.plugins.javadoc.options.JavadocOptions;
 import org.apache.maven.plugins.javadoc.options.Tag;
 import org.junit.Test;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 public class JavadocOptionsXpp3ReaderTest
 {
 
@@ -37,10 +37,10 @@ public class JavadocOptionsXpp3ReaderTest
         StringReader reader = new StringReader(testString);
 
         JavadocOptions options = parser.read(reader);
-        assertEquals(1, options.getTags().size());
+        assertThat( options.getTags().size() ).isEqualTo( 1 );
         Tag tag = options.getTags().get(0);
-        assertEquals("foo", tag.getName());
-        assertEquals("bar", tag.getHead());
+        assertThat( tag.getName() ).isEqualTo( "foo" );
+        assertThat( tag.getHead() ).isEqualTo( "bar" );
     }
     
     @Test
@@ -50,10 +50,10 @@ public class JavadocOptionsXpp3ReaderTest
         StringReader reader = new StringReader(testString);
 
         JavadocOptions options = parser.read(reader);
-        assertEquals(1, options.getTags().size());
+        assertThat( options.getTags().size() ).isEqualTo( 1 );
         Tag tag = options.getTags().get(0);
-        assertEquals("foo", tag.getName());
-        assertEquals("Xaoptcmf", tag.getPlacement());
+        assertThat( tag.getName() ).isEqualTo( "foo" );
+        assertThat( tag.getPlacement() ).isEqualTo( "Xaoptcmf" );
     }
 
 }
diff --git a/src/test/resources/unit/default-configuration/def/configuration/App.java b/src/test/resources/unit/default-configuration/def/configuration/App.java
index b7ab0b2..4bf8536 100644
--- a/src/test/resources/unit/default-configuration/def/configuration/App.java
+++ b/src/test/resources/unit/default-configuration/def/configuration/App.java
@@ -22,6 +22,9 @@ package def.configuration;
 public class App
 {
 
+    @Deprecated
+    public int notUsed = 0;
+
     public static void main( String[] args )
     {
         System.out.println( "Sample Application." );
diff --git a/src/test/resources/unit/default-configuration/def/configuration/AppSample.java b/src/test/resources/unit/default-configuration/def/configuration/AppSample.java
index 411094c..6f04709 100644
--- a/src/test/resources/unit/default-configuration/def/configuration/AppSample.java
+++ b/src/test/resources/unit/default-configuration/def/configuration/AppSample.java
@@ -26,7 +26,7 @@ package def.configuration;
  */
 public class AppSample
 {
-
+    public static final String CONST = "My Constant";
     /**
      * The main method
      *


[maven-javadoc-plugin] 05/07: Replace dependency to junit-addons with direct reflection calls

Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch next
in repository https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git

commit 41f4e96a9fc2485001c9939954b94fd617948fb1
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Sun Jan 31 20:32:27 2021 +0100

    Replace dependency to junit-addons with direct reflection calls
---
 pom.xml                                            |   6 -
 .../maven/plugins/javadoc/FixJavadocMojoTest.java  | 165 ++++++++-------------
 2 files changed, 65 insertions(+), 106 deletions(-)

diff --git a/pom.xml b/pom.xml
index 1318025..5cb55f9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -317,12 +317,6 @@ under the License.
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>junit-addons</groupId>
-      <artifactId>junit-addons</artifactId>
-      <version>1.4</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
       <groupId>org.apache.maven.plugin-testing</groupId>
       <artifactId>maven-plugin-testing-harness</artifactId>
       <version>2.1</version>
diff --git a/src/test/java/org/apache/maven/plugins/javadoc/FixJavadocMojoTest.java b/src/test/java/org/apache/maven/plugins/javadoc/FixJavadocMojoTest.java
index a13d961..d4f4b90 100644
--- a/src/test/java/org/apache/maven/plugins/javadoc/FixJavadocMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/javadoc/FixJavadocMojoTest.java
@@ -22,6 +22,7 @@ package org.apache.maven.plugins.javadoc;
 import java.io.File;
 import java.io.IOException;
 import java.io.StringReader;
+import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -42,7 +43,7 @@ import com.thoughtworks.qdox.model.DocletTag;
 import com.thoughtworks.qdox.model.JavaClass;
 import com.thoughtworks.qdox.model.JavaMethod;
 
-import junitx.util.PrivateAccessor;
+import static org.apache.commons.lang3.reflect.MethodUtils.invokeMethod;
 
 /**
  * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
@@ -129,134 +130,109 @@ public class FixJavadocMojoTest
     // ----------------------------------------------------------------------
 
     /**
-     * @throws Throwable if any
+     * @throws Exception if any
      */
     public void testAutodetectIndentation()
-        throws Throwable
+        throws Exception
     {
+        Method method = AbstractFixJavadocMojo.class.getDeclaredMethod( "autodetectIndentation", String.class );
+        method.setAccessible( true );
+
         String s = null;
-        assertEquals( "", PrivateAccessor.invoke( AbstractFixJavadocMojo.class, "autodetectIndentation",
-                                                  new Class[] { String.class }, new Object[] { s } ) );
+        assertEquals( "", (String) method.invoke( null, s ) );
 
         s = "no indentation";
-        assertEquals( "", PrivateAccessor.invoke( AbstractFixJavadocMojo.class, "autodetectIndentation",
-                                                  new Class[] { String.class }, new Object[] { s } ) );
+        assertEquals( "", (String) method.invoke( null, s ) );
 
         s = "no indentation with right spaces  ";
-        assertEquals( "", PrivateAccessor.invoke( AbstractFixJavadocMojo.class, "autodetectIndentation",
-                                                  new Class[] { String.class }, new Object[] { s } ) );
+        assertEquals( "", (String) method.invoke( null, s ) );
 
         s = "    indentation";
-        assertEquals( "    ", PrivateAccessor.invoke( AbstractFixJavadocMojo.class, "autodetectIndentation",
-                                                      new Class[] { String.class }, new Object[] { s } ) );
+        assertEquals( "    ", (String) method.invoke( null, s ) );
 
         s = "    indentation with right spaces  ";
-        assertEquals( "    ", PrivateAccessor.invoke( AbstractFixJavadocMojo.class, "autodetectIndentation",
-                                                      new Class[] { String.class }, new Object[] { s } ) );
+        assertEquals( "    ", (String) method.invoke( null, s ) );
 
         s = "\ttab indentation";
-        assertEquals( "\t", PrivateAccessor.invoke( AbstractFixJavadocMojo.class, "autodetectIndentation",
-                                                    new Class[] { String.class }, new Object[] { s } ) );
+        assertEquals( "\t", (String) method.invoke( null, s ) );
 
         s = "  \n  indentation with right spaces  ";
-        assertEquals( "  \n  ", PrivateAccessor.invoke( AbstractFixJavadocMojo.class, "autodetectIndentation",
-                                                        new Class[] { String.class }, new Object[] { s } ) );
+        assertEquals( "  \n  ", (String) method.invoke( null, s ) );
     }
 
     /**
-     * @throws Throwable if any
+     * @throws Exception if any
      */
     public void testTrimLeft()
-        throws Throwable
+        throws Exception
     {
-        assertEquals( "", PrivateAccessor.invoke( AbstractFixJavadocMojo.class, "trimLeft",
-                                                  new Class[] { String.class }, new Object[] { null } ) );
-        assertEquals( "", PrivateAccessor.invoke( AbstractFixJavadocMojo.class, "trimLeft",
-                                                  new Class[] { String.class }, new Object[] { "  " } ) );
-        assertEquals( "", PrivateAccessor.invoke( AbstractFixJavadocMojo.class, "trimLeft",
-                                                  new Class[] { String.class }, new Object[] { "  \t  " } ) );
-        assertEquals( "a", PrivateAccessor.invoke( AbstractFixJavadocMojo.class, "trimLeft",
-                                                   new Class[] { String.class }, new Object[] { "a" } ) );
-        assertEquals( "a", PrivateAccessor.invoke( AbstractFixJavadocMojo.class, "trimLeft",
-                                                   new Class[] { String.class }, new Object[] { "  a" } ) );
-        assertEquals( "a", PrivateAccessor.invoke( AbstractFixJavadocMojo.class, "trimLeft",
-                                                   new Class[] { String.class }, new Object[] { "\ta" } ) );
-        assertEquals( "a  ", PrivateAccessor.invoke( AbstractFixJavadocMojo.class, "trimLeft",
-                                                     new Class[] { String.class }, new Object[] { "  a  " } ) );
-        assertEquals( "a\t", PrivateAccessor.invoke( AbstractFixJavadocMojo.class, "trimLeft",
-                                                     new Class[] { String.class }, new Object[] { "\ta\t" } ) );
+        Method method = AbstractFixJavadocMojo.class.getDeclaredMethod( "trimLeft", String.class );
+        method.setAccessible( true );
+
+        assertEquals( "", (String) method.invoke( null, (String) null ) );
+        assertEquals( "", (String) method.invoke( null, "  " ) );
+        assertEquals( "", (String) method.invoke( null, "  \t  " ) );
+        assertEquals( "a", (String) method.invoke( null, "a" ) );
+        assertEquals( "a", (String) method.invoke( null, "  a" ) );
+        assertEquals( "a", (String) method.invoke( null, "\ta" ) );
+        assertEquals( "a  ", (String) method.invoke( null, "  a  " ) );
+        assertEquals( "a\t", (String) method.invoke( null, "\ta\t" ) );
     }
 
     /**
-     * @throws Throwable if any
+     * @throws Exception if any
      */
     public void testTrimRight()
-        throws Throwable
+        throws Exception
     {
-        assertEquals( "", PrivateAccessor.invoke( AbstractFixJavadocMojo.class, "trimRight",
-                                                  new Class[] { String.class }, new Object[] { null } ) );
-        assertEquals( "", PrivateAccessor.invoke( AbstractFixJavadocMojo.class, "trimRight",
-                                                  new Class[] { String.class }, new Object[] { "  " } ) );
-        assertEquals( "", PrivateAccessor.invoke( AbstractFixJavadocMojo.class, "trimRight",
-                                                  new Class[] { String.class }, new Object[] { "  \t  " } ) );
-        assertEquals( "a", PrivateAccessor.invoke( AbstractFixJavadocMojo.class, "trimRight",
-                                                   new Class[] { String.class }, new Object[] { "a" } ) );
-        assertEquals( "a", PrivateAccessor.invoke( AbstractFixJavadocMojo.class, "trimRight",
-                                                   new Class[] { String.class }, new Object[] { "a  " } ) );
-        assertEquals( "a", PrivateAccessor.invoke( AbstractFixJavadocMojo.class, "trimRight",
-                                                   new Class[] { String.class }, new Object[] { "a\t" } ) );
-        assertEquals( "  a", PrivateAccessor.invoke( AbstractFixJavadocMojo.class, "trimRight",
-                                                     new Class[] { String.class }, new Object[] { "  a  " } ) );
-        assertEquals( "\ta", PrivateAccessor.invoke( AbstractFixJavadocMojo.class, "trimRight",
-                                                     new Class[] { String.class }, new Object[] { "\ta\t" } ) );
+        Method method = AbstractFixJavadocMojo.class.getDeclaredMethod( "trimRight", String.class );
+        method.setAccessible( true );
+
+        assertEquals( "", (String) method.invoke( null, (String)null ) );
+        assertEquals( "", (String) method.invoke( null, "  " ) );
+        assertEquals( "", (String) method.invoke( null, "  \t  " ) );
+        assertEquals( "a", (String) method.invoke( null, "a" ) );
+        assertEquals( "a", (String) method.invoke( null, "a  " ) );
+        assertEquals( "a", (String) method.invoke( null, "a\t" ) );
+        assertEquals( "  a", (String) method.invoke( null, "  a  " ) );
+        assertEquals( "\ta", (String) method.invoke( null, "\ta\t" ) );
     }
 
     /**
-     * @throws Throwable if any
+     * @throws Exception if any
      */
     public void testHasInheritedTag()
-        throws Throwable
+        throws Exception
     {
+        Method method = AbstractFixJavadocMojo.class.getDeclaredMethod( "hasInheritedTag", String.class );
+        method.setAccessible( true );
+
         String content = "/** {@inheritDoc} */";
-        Boolean has =
-            (Boolean) PrivateAccessor.invoke( AbstractFixJavadocMojo.class, "hasInheritedTag",
-                                              new Class[] { String.class }, new Object[] { content } );
+        Boolean has = (Boolean) method.invoke( null, content );
         assertEquals( Boolean.TRUE, has );
 
         content = "/**{@inheritDoc}*/";
-        has =
-            (Boolean) PrivateAccessor.invoke( AbstractFixJavadocMojo.class, "hasInheritedTag",
-                                              new Class[] { String.class }, new Object[] { content } );
+        has = (Boolean) method.invoke( null, content );
         assertEquals( Boolean.TRUE, has );
 
         content = "/**{@inheritDoc  }  */";
-        has =
-            (Boolean) PrivateAccessor.invoke( AbstractFixJavadocMojo.class, "hasInheritedTag",
-                                              new Class[] { String.class }, new Object[] { content } );
+        has = (Boolean) method.invoke( null, content );
         assertEquals( Boolean.TRUE, has );
 
         content = "/**  {@inheritDoc  }  */";
-        has =
-            (Boolean) PrivateAccessor.invoke( AbstractFixJavadocMojo.class, "hasInheritedTag",
-                                              new Class[] { String.class }, new Object[] { content } );
+        has = (Boolean) method.invoke( null, content );
         assertEquals( Boolean.TRUE, has );
 
         content = "/** */";
-        has =
-            (Boolean) PrivateAccessor.invoke( AbstractFixJavadocMojo.class, "hasInheritedTag",
-                                              new Class[] { String.class }, new Object[] { content } );
+        has = (Boolean) method.invoke( null, content );
         assertEquals( Boolean.FALSE, has );
 
         content = "/**{  @inheritDoc  }*/";
-        has =
-            (Boolean) PrivateAccessor.invoke( AbstractFixJavadocMojo.class, "hasInheritedTag",
-                                              new Class[] { String.class }, new Object[] { content } );
+        has = (Boolean) method.invoke( null, content );
         assertEquals( Boolean.FALSE, has );
 
         content = "/**{@ inheritDoc}*/";
-        has =
-            (Boolean) PrivateAccessor.invoke( AbstractFixJavadocMojo.class, "hasInheritedTag",
-                                              new Class[] { String.class }, new Object[] { content } );
+        has = (Boolean) method.invoke( null, content );
         assertEquals( Boolean.FALSE, has );
     }
 
@@ -348,9 +324,10 @@ public class FixJavadocMojoTest
                       "     * any" + EOL +
                       "     *", javadocContent );
 
-        String withoutEmptyJavadocLines =
-            (String) PrivateAccessor.invoke( AbstractFixJavadocMojo.class, "removeLastEmptyJavadocLines",
-                                             new Class[] { String.class }, new Object[] { javadocContent } );
+        Method method = AbstractFixJavadocMojo.class.getDeclaredMethod( "removeLastEmptyJavadocLines", String.class );
+        method.setAccessible( true );
+
+        String withoutEmptyJavadocLines = (String) method.invoke( null, javadocContent  );
         assertTrue( withoutEmptyJavadocLines.endsWith( "any" ) );
 
         String methodJavadoc = AbstractFixJavadocMojo.getJavadocComment( content, javaMethod );
@@ -359,9 +336,7 @@ public class FixJavadocMojoTest
                 "     *" + EOL +
                 "     *      Method." + EOL +
                 "     *", methodJavadoc );
-        withoutEmptyJavadocLines =
-            (String) PrivateAccessor.invoke( AbstractFixJavadocMojo.class, "removeLastEmptyJavadocLines",
-                                             new Class[] { String.class }, new Object[] { methodJavadoc } );
+        withoutEmptyJavadocLines = (String) method.invoke( null, methodJavadoc );
         assertTrue( withoutEmptyJavadocLines.endsWith( "Method." ) );
 
         assertEquals( 5, javaMethod.getTags().size() );
@@ -374,17 +349,13 @@ public class FixJavadocMojoTest
         assertEquals( "     * @param args not" + EOL +
                 "     *" + EOL +
                 "     * null", tagJavadoc );
-        withoutEmptyJavadocLines =
-            (String) PrivateAccessor.invoke( AbstractFixJavadocMojo.class, "removeLastEmptyJavadocLines",
-                                             new Class[] { String.class }, new Object[] { tagJavadoc } );
+        withoutEmptyJavadocLines = (String) method.invoke( null, tagJavadoc );
         assertTrue( withoutEmptyJavadocLines.endsWith( "null" ) );
 
         tag = javaMethod.getTags().get( 1 );
         tagJavadoc = mojoInstance.getJavadocComment( content, javaMethod, tag );
         assertEquals( "     * @param i non negative", tagJavadoc );
-        withoutEmptyJavadocLines =
-            (String) PrivateAccessor.invoke( AbstractFixJavadocMojo.class, "removeLastEmptyJavadocLines",
-                                             new Class[] { String.class }, new Object[] { tagJavadoc } );
+        withoutEmptyJavadocLines = (String) method.invoke( null, tagJavadoc );
         assertTrue( withoutEmptyJavadocLines.endsWith( "negative" ) );
 
         tag = javaMethod.getTags().get( 2 );
@@ -392,9 +363,7 @@ public class FixJavadocMojoTest
         assertEquals( "     * @param object could" + EOL +
                 "     * be" + EOL +
                 "     *      null", tagJavadoc );
-        withoutEmptyJavadocLines =
-            (String) PrivateAccessor.invoke( AbstractFixJavadocMojo.class, "removeLastEmptyJavadocLines",
-                                             new Class[] { String.class }, new Object[] { tagJavadoc } );
+        withoutEmptyJavadocLines = (String) method.invoke( null, tagJavadoc );
         assertTrue( withoutEmptyJavadocLines.endsWith( "null" ) );
 
         tag = javaMethod.getTags().get( 3 );
@@ -402,9 +371,7 @@ public class FixJavadocMojoTest
         assertEquals( "     * @return a" + EOL +
                 "     * String" + EOL +
                 "     *", tagJavadoc );
-        withoutEmptyJavadocLines =
-            (String) PrivateAccessor.invoke( AbstractFixJavadocMojo.class, "removeLastEmptyJavadocLines",
-                                             new Class[] { String.class }, new Object[] { tagJavadoc } );
+        withoutEmptyJavadocLines = (String) method.invoke( null, tagJavadoc );
         assertTrue( withoutEmptyJavadocLines.endsWith( "String" ) );
 
         tag = javaMethod.getTags().get( 4 );
@@ -412,9 +379,7 @@ public class FixJavadocMojoTest
         assertEquals( "     * @throws Exception if" + EOL +
                 "     * any" + EOL +
                 "     *", tagJavadoc );
-        withoutEmptyJavadocLines =
-            (String) PrivateAccessor.invoke( AbstractFixJavadocMojo.class, "removeLastEmptyJavadocLines",
-                                             new Class[] { String.class }, new Object[] { tagJavadoc } );
+        withoutEmptyJavadocLines = (String) method.invoke( null, tagJavadoc );
         assertTrue( withoutEmptyJavadocLines.endsWith( "any" ) );
     }
 
@@ -479,8 +444,8 @@ public class FixJavadocMojoTest
         setVariableValueToObject( mojoInstance, "fixTags", "author, version, since, param, return, throws, link" );
         setVariableValueToObject(mojoInstance, "defaultSince", "1.0");
         setVariableValueToObject(mojoInstance, "level", "protected");
-        
-        PrivateAccessor.invoke( mojoInstance, "init", new Class[] { }, new String[] { } );
+
+        invokeMethod( mojoInstance, true, "init" );
         
         String[] fixTags = (String[]) getVariableValueFromObject(mojoInstance, "fixTagsSplitted");
         
@@ -494,7 +459,7 @@ public class FixJavadocMojoTest
         assertEquals(7, fixTags.length);
         
         setVariableValueToObject( mojoInstance, "fixTags", "return, fake_value" );
-        PrivateAccessor.invoke( mojoInstance, "init", new Class[] { }, new String[] { } );
+        invokeMethod( mojoInstance, true, "init" );
         fixTags = (String[]) getVariableValueFromObject(mojoInstance, "fixTagsSplitted");
         
         assertEquals("return", fixTags[0]);


[maven-javadoc-plugin] 02/07: (doc) misc dependency updates in integration tests

Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch next
in repository https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git

commit c393c9c0a03e87b2de5a7dc82862cec9d9ca3319
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Sun Jan 31 18:09:10 2021 +0100

    (doc) misc dependency updates in integration tests
---
 src/it/projects/MJAVADOC-172/test-module1/pom.xml | 2 +-
 src/it/projects/MJAVADOC-172/test-module2/pom.xml | 2 +-
 src/it/projects/MJAVADOC-434_fixcompile/pom.xml   | 4 ++--
 src/it/projects/detectLinks/pom.xml               | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/it/projects/MJAVADOC-172/test-module1/pom.xml b/src/it/projects/MJAVADOC-172/test-module1/pom.xml
index 348d97c..dc8a985 100644
--- a/src/it/projects/MJAVADOC-172/test-module1/pom.xml
+++ b/src/it/projects/MJAVADOC-172/test-module1/pom.xml
@@ -34,7 +34,7 @@
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
-      <version>3.8.1</version>
+      <version>4.13.1</version>
     </dependency>
   </dependencies>
 </project>
\ No newline at end of file
diff --git a/src/it/projects/MJAVADOC-172/test-module2/pom.xml b/src/it/projects/MJAVADOC-172/test-module2/pom.xml
index d8f3f4b..d176f8a 100644
--- a/src/it/projects/MJAVADOC-172/test-module2/pom.xml
+++ b/src/it/projects/MJAVADOC-172/test-module2/pom.xml
@@ -34,7 +34,7 @@
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
-      <version>3.8.2</version>
+      <version>4.13.1</version>
     </dependency>
   </dependencies>
 </project>
\ No newline at end of file
diff --git a/src/it/projects/MJAVADOC-434_fixcompile/pom.xml b/src/it/projects/MJAVADOC-434_fixcompile/pom.xml
index 75f71ba..6d6a0ce 100644
--- a/src/it/projects/MJAVADOC-434_fixcompile/pom.xml
+++ b/src/it/projects/MJAVADOC-434_fixcompile/pom.xml
@@ -48,12 +48,12 @@
     <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-context</artifactId>
-      <version>3.2.2.RELEASE</version>
+      <version>4.3.29.RELEASE</version>
     </dependency>
     <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-webmvc</artifactId>
-      <version>3.2.2.RELEASE</version>
+      <version>4.3.29.RELEASE</version>
     </dependency>
     <dependency>
       <groupId>org.slf4j</groupId>
diff --git a/src/it/projects/detectLinks/pom.xml b/src/it/projects/detectLinks/pom.xml
index ed387e8..7cc3958 100644
--- a/src/it/projects/detectLinks/pom.xml
+++ b/src/it/projects/detectLinks/pom.xml
@@ -48,7 +48,7 @@
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
-      <version>3.8.2</version>
+      <version>4.13.1</version>
     </dependency>
     <!-- unknown apidocs link -->
     <dependency>


[maven-javadoc-plugin] 04/07: Bump plexus-java from 1.0.5 to 1.0.6

Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch next
in repository https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git

commit 043d92eb3ebde0ef1d408acb68d9d1f1752a24f0
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Sun Jan 31 18:15:18 2021 +0100

    Bump plexus-java from 1.0.5 to 1.0.6
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index eb28331..1318025 100644
--- a/pom.xml
+++ b/pom.xml
@@ -72,7 +72,7 @@ under the License.
     <doxia-sitetoolsVersion>1.9.2</doxia-sitetoolsVersion>
     <wagonVersion>2.4</wagonVersion>
     <sonatypeAetherVersion>1.13.1</sonatypeAetherVersion>
-    <plexus-java.version>1.0.5</plexus-java.version>
+    <plexus-java.version>1.0.6</plexus-java.version>
     <!-- for ITs -->
     <sitePluginVersion>3.3</sitePluginVersion>
     <projectInfoReportsPluginVersion>2.7</projectInfoReportsPluginVersion>