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 2020/04/16 20:10:50 UTC

[maven-antrun-plugin] 03/05: [MANTRUN-224] Upgrade tests to JUnit5

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

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

commit 8fc2aee35d75b85c9d52384f88cc63368b310f18
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Wed Apr 15 23:53:27 2020 +0200

    [MANTRUN-224] Upgrade tests to JUnit5
---
 pom.xml                                            | 12 +++------
 src/it/MANTRUN-208/pom.xml                         |  6 ++---
 src/it/antrun-default-test/pom.xml                 |  6 ++---
 src/it/classpath-ref-test/pom.xml                  |  6 ++---
 src/it/classpath-test-scope-test/pom.xml           |  6 ++---
 src/it/env-var-test/pom.xml                        |  6 ++---
 src/it/filesets-test/pom.xml                       |  8 +++---
 src/it/filesets-test/verify.bsh                    |  4 +--
 src/it/local-repo-prop-test/pom.xml                |  6 ++---
 src/it/properties-test/build.xml                   |  4 +--
 src/it/properties-test/pom.xml                     |  6 ++---
 .../AntrunXmlPlexusConfigurationWriterTest.java    | 31 +++++++++-------------
 12 files changed, 45 insertions(+), 56 deletions(-)

diff --git a/pom.xml b/pom.xml
index 3526779..a402e31 100644
--- a/pom.xml
+++ b/pom.xml
@@ -100,15 +100,9 @@ under the License.
     </dependency>
 
     <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>4.13</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.hamcrest</groupId>
-      <artifactId>hamcrest-core</artifactId>
-      <version>1.3</version>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-engine</artifactId>
+      <version>5.6.2</version>
       <scope>test</scope>
     </dependency>
     <dependency>
diff --git a/src/it/MANTRUN-208/pom.xml b/src/it/MANTRUN-208/pom.xml
index b8cccf9..e6db120 100644
--- a/src/it/MANTRUN-208/pom.xml
+++ b/src/it/MANTRUN-208/pom.xml
@@ -32,9 +32,9 @@ under the License.
     <url>http://maven.apache.org</url>
     <dependencies>
         <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <version>4.13</version>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-engine</artifactId>
+            <version>5.6.2</version>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git a/src/it/antrun-default-test/pom.xml b/src/it/antrun-default-test/pom.xml
index a074ad5..3c44f11 100644
--- a/src/it/antrun-default-test/pom.xml
+++ b/src/it/antrun-default-test/pom.xml
@@ -32,9 +32,9 @@ under the License.
   <url>http://maven.apache.org</url>
   <dependencies>
     <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>4.12</version>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-engine</artifactId>
+      <version>5.6.2</version>
       <scope>test</scope>
     </dependency>
   </dependencies>
diff --git a/src/it/classpath-ref-test/pom.xml b/src/it/classpath-ref-test/pom.xml
index 73e5f06..6d8f3bf 100644
--- a/src/it/classpath-ref-test/pom.xml
+++ b/src/it/classpath-ref-test/pom.xml
@@ -32,9 +32,9 @@ under the License.
 
   <dependencies>
     <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>4.12</version>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-engine</artifactId>
+      <version>5.6.2</version>
     </dependency>
   </dependencies>
 
diff --git a/src/it/classpath-test-scope-test/pom.xml b/src/it/classpath-test-scope-test/pom.xml
index c046a01..c921449 100644
--- a/src/it/classpath-test-scope-test/pom.xml
+++ b/src/it/classpath-test-scope-test/pom.xml
@@ -32,9 +32,9 @@ under the License.
 
   <dependencies>
     <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>4.12</version>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-engine</artifactId>
+      <version>5.6.2</version>
       <scope>test</scope>
     </dependency>
   </dependencies>
diff --git a/src/it/env-var-test/pom.xml b/src/it/env-var-test/pom.xml
index 6715a20..2bfd47c 100644
--- a/src/it/env-var-test/pom.xml
+++ b/src/it/env-var-test/pom.xml
@@ -32,9 +32,9 @@ under the License.
 
   <dependencies>
     <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>4.12</version>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-engine</artifactId>
+      <version>5.6.2</version>
       <scope>test</scope>
     </dependency>
   </dependencies>
diff --git a/src/it/filesets-test/pom.xml b/src/it/filesets-test/pom.xml
index aa6267a..a56444c 100755
--- a/src/it/filesets-test/pom.xml
+++ b/src/it/filesets-test/pom.xml
@@ -49,7 +49,7 @@ under the License.
                 <dependencyfilesets prefix="test."/>
                 <mkdir dir="target/dependencies"/>
                 <copy todir="target/dependencies">
-                  <fileset refid="test.junit:junit:jar"/>
+                  <fileset refid="test.org.junit.jupiter:junit-jupiter-engine:jar"/>
                   <fileset refid="test.org.apache.ant:ant:jar"/>
                 </copy>
 
@@ -73,9 +73,9 @@ under the License.
       <version>1.9.14</version>
     </dependency>
     <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>4.12</version>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-engine</artifactId>
+      <version>5.6.2</version>
     </dependency>
   </dependencies>
 
diff --git a/src/it/filesets-test/verify.bsh b/src/it/filesets-test/verify.bsh
index ad846c5..068e3ff 100644
--- a/src/it/filesets-test/verify.bsh
+++ b/src/it/filesets-test/verify.bsh
@@ -28,7 +28,7 @@ try
 {
     File depsDir = new File( basedir, "target/dependencies" );
     File antJar = new File( depsDir, "ant-1.9.14.jar" );
-    File junitJar = new File( depsDir, "junit-4.12.jar" );
+    File junitJar = new File( depsDir, "junit-jupiter-engine-5.6.2.jar" );
 
     if ( ! antJar.exists() || antJar.isDirectory() )
     {
@@ -43,7 +43,7 @@ try
 
     File deps2Dir = new File( basedir, "target/dependencies2" );
     antJar = new File( deps2Dir, "ant-1.9.14.jar" );
-    junitJar = new File( deps2Dir, "junit-4.12.jar" );
+    junitJar = new File( deps2Dir, "junit-jupiter-api-5.6.2.jar" );
 
     if ( ! antJar.exists() || antJar.isDirectory() )
     {
diff --git a/src/it/local-repo-prop-test/pom.xml b/src/it/local-repo-prop-test/pom.xml
index d4a126c..0df6818 100644
--- a/src/it/local-repo-prop-test/pom.xml
+++ b/src/it/local-repo-prop-test/pom.xml
@@ -32,9 +32,9 @@ under the License.
   <url>http://maven.apache.org</url>
   <dependencies>
     <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>4.12</version>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-engine</artifactId>
+      <version>5.6.2</version>
       <scope>test</scope>
     </dependency>
   </dependencies>
diff --git a/src/it/properties-test/build.xml b/src/it/properties-test/build.xml
index c535007..3ea0fc7 100755
--- a/src/it/properties-test/build.xml
+++ b/src/it/properties-test/build.xml
@@ -40,8 +40,8 @@ under the License.
     <fail unless="line.separator" message="Property not set \${line.separator}"/>
 
     <!-- Dependency artifact properties -->
-    <echo message="junit:junit:jar : ${junit:junit:jar}"/>
-    <fail unless="junit:junit:jar" message="Property not set \${junit:junit:jar}"/>
+    <echo message="org.junit.jupiter:junit-jupiter-engine:jar : ${org.junit.jupiter:junit-jupiter-engine:jar}"/>
+    <fail unless="org.junit.jupiter:junit-jupiter-engine:jar" message="Property not set \${org.junit.jupiter:junit-jupiter-engine:jar}"/>
 
     <!-- Check that the build output dir is pointing to the correct location -->
     <property name="outputDir" location="./target/classes"/>
diff --git a/src/it/properties-test/pom.xml b/src/it/properties-test/pom.xml
index 5578d95..70a9c11 100644
--- a/src/it/properties-test/pom.xml
+++ b/src/it/properties-test/pom.xml
@@ -32,9 +32,9 @@ under the License.
 
   <dependencies>
     <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>4.13</version>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-engine</artifactId>
+      <version>5.6.2</version>
     </dependency>
   </dependencies>
 
diff --git a/src/test/java/org/apache/maven/plugins/antrun/AntrunXmlPlexusConfigurationWriterTest.java b/src/test/java/org/apache/maven/plugins/antrun/AntrunXmlPlexusConfigurationWriterTest.java
index fe66f6f..4a7a83b 100644
--- a/src/test/java/org/apache/maven/plugins/antrun/AntrunXmlPlexusConfigurationWriterTest.java
+++ b/src/test/java/org/apache/maven/plugins/antrun/AntrunXmlPlexusConfigurationWriterTest.java
@@ -19,17 +19,18 @@ package org.apache.maven.plugins.antrun;
  * under the License.
  */
 
-import java.io.File;
-import java.io.IOException;
-
 import org.codehaus.plexus.configuration.PlexusConfiguration;
 import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
 import org.xmlunit.builder.Input;
 
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.xmlunit.matchers.CompareMatcher.isIdenticalTo;
 
@@ -42,7 +43,8 @@ public class AntrunXmlPlexusConfigurationWriterTest
 
     private static final String TARGET_NAME = "main";
 
-    private TemporaryFolder folder = new TemporaryFolder();
+    @TempDir
+    Path folder;
 
     private AntrunXmlPlexusConfigurationWriter configurationWriter;
 
@@ -50,14 +52,14 @@ public class AntrunXmlPlexusConfigurationWriterTest
 
     private File file;
 
-    @Before
-    public void setUp()
+    @BeforeEach
+    void setUp()
         throws IOException
     {
         configurationWriter = new AntrunXmlPlexusConfigurationWriter();
         configuration = new XmlPlexusConfiguration( "target" );
         configuration.setAttribute( "name", TARGET_NAME );
-        file = folder.newFile();
+        file = Files.createTempFile(folder, "junit", "antrun").toFile();
     }
 
     /**
@@ -123,11 +125,4 @@ public class AntrunXmlPlexusConfigurationWriterTest
     {
         assertThat( Input.from( file ), isIdenticalTo( Input.from( getClass().getResourceAsStream( expected ) ) ) );
     }
-
-    @Rule
-    public TemporaryFolder getFolder()
-    {
-        return folder;
-    }
-
 }