You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gn...@apache.org on 2020/01/27 15:47:24 UTC

[camel] 03/10: [CAMEL-14437] Switch to junit 5

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

gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit b3a03293b35bb602b78080236cb13e01808e5981
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Fri Jan 24 14:00:38 2020 +0100

    [CAMEL-14437] Switch to junit 5
---
 tooling/camel-tooling-util/pom.xml                 | 23 ++++++++++++++++++++--
 .../camel/tooling/util/JSonSchemaHelperTest.java   | 11 ++++++-----
 .../camel/tooling/util/PackageHelperTest.java      | 14 ++++++-------
 .../org/apache/camel/tooling/util/StringsTest.java |  4 ++--
 4 files changed, 36 insertions(+), 16 deletions(-)

diff --git a/tooling/camel-tooling-util/pom.xml b/tooling/camel-tooling-util/pom.xml
index d565914..c4f7571 100644
--- a/tooling/camel-tooling-util/pom.xml
+++ b/tooling/camel-tooling-util/pom.xml
@@ -36,10 +36,29 @@
             <groupId>org.apache.camel</groupId>
             <artifactId>camel-util-json</artifactId>
         </dependency>
+
+        <!-- testing -->
         <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-api</artifactId>
+            <version>${junit-jupiter-version}</version>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-engine</artifactId>
+            <version>${junit-jupiter-version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-params</artifactId>
+            <version>${junit-jupiter-version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.assertj</groupId>
+            <artifactId>assertj-core</artifactId>
+        </dependency>
     </dependencies>
 </project>
diff --git a/tooling/camel-tooling-util/src/test/java/org/apache/camel/tooling/util/JSonSchemaHelperTest.java b/tooling/camel-tooling-util/src/test/java/org/apache/camel/tooling/util/JSonSchemaHelperTest.java
index ea30d9b..8a0421c 100644
--- a/tooling/camel-tooling-util/src/test/java/org/apache/camel/tooling/util/JSonSchemaHelperTest.java
+++ b/tooling/camel-tooling-util/src/test/java/org/apache/camel/tooling/util/JSonSchemaHelperTest.java
@@ -16,8 +16,9 @@
  */
 package org.apache.camel.tooling.util;
 
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 public class JSonSchemaHelperTest {
 
@@ -72,12 +73,12 @@ public class JSonSchemaHelperTest {
     public void testSanitizeJavaDoc() throws Exception {
         String s = "* more memory. The total size is provided in the {@link org.apache.camel.Exchange#SPLIT_SIZE} header.";
         String s2 = JSonSchemaHelper.sanitizeDescription(s, false);
-        Assert.assertEquals("more memory. The total size is provided in the org.apache.camel.Exchange#SPLIT_SIZE header.", s2);
+        assertEquals("more memory. The total size is provided in the org.apache.camel.Exchange#SPLIT_SIZE header.", s2);
 
         String out = JSonSchemaHelper.sanitizeDescription(JAVADOC, false);
-        Assert.assertEquals(EXPECTED_OUT, out);
+        assertEquals(EXPECTED_OUT, out);
 
         String out2 = JSonSchemaHelper.sanitizeDescription(JAVADOC2, false);
-        Assert.assertEquals(EXPECTED_OUT2, out2);
+        assertEquals(EXPECTED_OUT2, out2);
     }
 }
diff --git a/tooling/camel-tooling-util/src/test/java/org/apache/camel/tooling/util/PackageHelperTest.java b/tooling/camel-tooling-util/src/test/java/org/apache/camel/tooling/util/PackageHelperTest.java
index 2fff48d..870bf66 100644
--- a/tooling/camel-tooling-util/src/test/java/org/apache/camel/tooling/util/PackageHelperTest.java
+++ b/tooling/camel-tooling-util/src/test/java/org/apache/camel/tooling/util/PackageHelperTest.java
@@ -21,12 +21,12 @@ import java.util.Map;
 import java.util.Set;
 import java.util.stream.Collectors;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import static org.apache.camel.tooling.util.PackageHelper.JSON_SUFIX;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 public class PackageHelperTest {
 
@@ -41,8 +41,8 @@ public class PackageHelperTest {
         Map<String, File> jsonFiles = jsons.stream().collect(Collectors.toMap(
                 file -> file.getName().replace(JSON_SUFIX, ""), file -> file));
 
-        assertTrue("Files a.json must be found", jsonFiles.containsKey("a"));
-        assertTrue("Files b.json must be found", jsonFiles.containsKey("b"));
-        assertFalse("File c.txt must not be found", jsonFiles.containsKey("c"));
+        assertTrue(jsonFiles.containsKey("a"), "Files a.json must be found");
+        assertTrue(jsonFiles.containsKey("b"), "Files b.json must be found");
+        assertFalse(jsonFiles.containsKey("c"), "File c.txt must not be found");
     }
 }
diff --git a/tooling/camel-tooling-util/src/test/java/org/apache/camel/tooling/util/StringsTest.java b/tooling/camel-tooling-util/src/test/java/org/apache/camel/tooling/util/StringsTest.java
index 9836494..8fdb849 100644
--- a/tooling/camel-tooling-util/src/test/java/org/apache/camel/tooling/util/StringsTest.java
+++ b/tooling/camel-tooling-util/src/test/java/org/apache/camel/tooling/util/StringsTest.java
@@ -16,11 +16,11 @@
  */
 package org.apache.camel.tooling.util;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import static org.apache.camel.tooling.util.Strings.asTitle;
 import static org.apache.camel.tooling.util.Strings.between;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 public class StringsTest {