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 b5a631da85cd326e93444e91420c3340c1a8a3dd
Author: Guillaume Nodet <gno...@gmail.com>
AuthorDate: Fri Jul 17 17:11:42 2020 +0200

    [CAMEL-11807] Upgrade camel-protobuf to junit5
---
 components/camel-protobuf/pom.xml                        |  6 +++---
 .../camel/dataformat/protobuf/ProtobufConverterTest.java | 16 ++++++++++------
 .../protobuf/ProtobufMarshalAndUnmarshalJsonTest.java    |  6 ++++--
 .../protobuf/ProtobufMarshalAndUnmarshalMapTest.java     |  6 ++++--
 .../protobuf/ProtobufMarshalAndUnmarshalSpringTest.java  | 10 +++++++---
 .../protobuf/ProtobufMarshalAndUnmarshalTest.java        | 10 +++++++---
 6 files changed, 35 insertions(+), 19 deletions(-)

diff --git a/components/camel-protobuf/pom.xml 
b/components/camel-protobuf/pom.xml
index 7d3970d..453feaf 100644
--- a/components/camel-protobuf/pom.xml
+++ b/components/camel-protobuf/pom.xml
@@ -58,12 +58,12 @@
         <!-- testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-spring</artifactId>
+            <artifactId>camel-test-spring-junit5</artifactId>
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter</artifactId>
             <scope>test</scope>
         </dependency>
         <dependency>
diff --git 
a/components/camel-protobuf/src/test/java/org/apache/camel/dataformat/protobuf/ProtobufConverterTest.java
 
b/components/camel-protobuf/src/test/java/org/apache/camel/dataformat/protobuf/ProtobufConverterTest.java
index 1af84df..a2fecdf 100644
--- 
a/components/camel-protobuf/src/test/java/org/apache/camel/dataformat/protobuf/ProtobufConverterTest.java
+++ 
b/components/camel-protobuf/src/test/java/org/apache/camel/dataformat/protobuf/ProtobufConverterTest.java
@@ -21,9 +21,11 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.camel.dataformat.protobuf.generated.AddressBookProtos;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 public class ProtobufConverterTest {
 
@@ -73,7 +75,7 @@ public class ProtobufConverterTest {
         assertEquals("awesome2", message.getNicknames(1));
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test
     public void testIfThrowsErrorInCaseNestedMessageNotMap() {
         final Map<String, Object> input = new HashMap<>();
 
@@ -81,10 +83,11 @@ public class ProtobufConverterTest {
         input.put("id", 1234);
         input.put("address", "wrong address");
 
-        final AddressBookProtos.Person message = (AddressBookProtos.Person) 
ProtobufConverter.toProto(input, AddressBookProtos.Person.getDefaultInstance());
+        assertThrows(IllegalArgumentException.class,
+            () -> ProtobufConverter.toProto(input, 
AddressBookProtos.Person.getDefaultInstance()));
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test
     public void testIfThrowsErrorInCaseRepeatedFieldIsNotList() {
         final Map<String, Object> input = new HashMap<>();
 
@@ -92,7 +95,8 @@ public class ProtobufConverterTest {
         input.put("id", 1234);
         input.put("nicknames", "wrong nickname");
 
-        final AddressBookProtos.Person message = (AddressBookProtos.Person) 
ProtobufConverter.toProto(input, AddressBookProtos.Person.getDefaultInstance());
+        assertThrows(IllegalArgumentException.class,
+            () -> ProtobufConverter.toProto(input, 
AddressBookProtos.Person.getDefaultInstance()));
     }
 
     @Test
diff --git 
a/components/camel-protobuf/src/test/java/org/apache/camel/dataformat/protobuf/ProtobufMarshalAndUnmarshalJsonTest.java
 
b/components/camel-protobuf/src/test/java/org/apache/camel/dataformat/protobuf/ProtobufMarshalAndUnmarshalJsonTest.java
index 5268918..189c960 100644
--- 
a/components/camel-protobuf/src/test/java/org/apache/camel/dataformat/protobuf/ProtobufMarshalAndUnmarshalJsonTest.java
+++ 
b/components/camel-protobuf/src/test/java/org/apache/camel/dataformat/protobuf/ProtobufMarshalAndUnmarshalJsonTest.java
@@ -19,8 +19,10 @@ package org.apache.camel.dataformat.protobuf;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.dataformat.protobuf.generated.AddressBookProtos.Person;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Test;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 public class ProtobufMarshalAndUnmarshalJsonTest extends CamelTestSupport {
     
diff --git 
a/components/camel-protobuf/src/test/java/org/apache/camel/dataformat/protobuf/ProtobufMarshalAndUnmarshalMapTest.java
 
b/components/camel-protobuf/src/test/java/org/apache/camel/dataformat/protobuf/ProtobufMarshalAndUnmarshalMapTest.java
index 201a5d6..efc9c1d 100644
--- 
a/components/camel-protobuf/src/test/java/org/apache/camel/dataformat/protobuf/ProtobufMarshalAndUnmarshalMapTest.java
+++ 
b/components/camel-protobuf/src/test/java/org/apache/camel/dataformat/protobuf/ProtobufMarshalAndUnmarshalMapTest.java
@@ -23,8 +23,10 @@ import java.util.Map;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.dataformat.protobuf.generated.AddressBookProtos.Person;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Test;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 public class ProtobufMarshalAndUnmarshalMapTest extends CamelTestSupport {
 
diff --git 
a/components/camel-protobuf/src/test/java/org/apache/camel/dataformat/protobuf/ProtobufMarshalAndUnmarshalSpringTest.java
 
b/components/camel-protobuf/src/test/java/org/apache/camel/dataformat/protobuf/ProtobufMarshalAndUnmarshalSpringTest.java
index 5f45287..6ae14b4 100644
--- 
a/components/camel-protobuf/src/test/java/org/apache/camel/dataformat/protobuf/ProtobufMarshalAndUnmarshalSpringTest.java
+++ 
b/components/camel-protobuf/src/test/java/org/apache/camel/dataformat/protobuf/ProtobufMarshalAndUnmarshalSpringTest.java
@@ -22,10 +22,14 @@ import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.dataformat.protobuf.generated.AddressBookProtos;
 import org.apache.camel.dataformat.protobuf.generated.AddressBookProtos.Person;
-import org.apache.camel.test.spring.CamelSpringTestSupport;
-import org.junit.Test;
+import org.apache.camel.test.spring.junit5.CamelSpringTestSupport;
+import org.junit.jupiter.api.Test;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
 public class ProtobufMarshalAndUnmarshalSpringTest extends 
CamelSpringTestSupport {
 
     @Override
@@ -59,7 +63,7 @@ public class ProtobufMarshalAndUnmarshalSpringTest extends 
CamelSpringTestSuppor
             });
             fail("Expect the exception here");
         } catch (Exception ex) {
-            assertTrue("Expect FailedToCreateRouteException", ex instanceof 
FailedToCreateRouteException);
+            assertTrue(ex instanceof FailedToCreateRouteException, "Expect 
FailedToCreateRouteException");
         }
     }
 
diff --git 
a/components/camel-protobuf/src/test/java/org/apache/camel/dataformat/protobuf/ProtobufMarshalAndUnmarshalTest.java
 
b/components/camel-protobuf/src/test/java/org/apache/camel/dataformat/protobuf/ProtobufMarshalAndUnmarshalTest.java
index ab25148..5d6a347 100644
--- 
a/components/camel-protobuf/src/test/java/org/apache/camel/dataformat/protobuf/ProtobufMarshalAndUnmarshalTest.java
+++ 
b/components/camel-protobuf/src/test/java/org/apache/camel/dataformat/protobuf/ProtobufMarshalAndUnmarshalTest.java
@@ -22,8 +22,12 @@ import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.dataformat.protobuf.generated.AddressBookProtos;
 import org.apache.camel.dataformat.protobuf.generated.AddressBookProtos.Person;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Test;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 
 public class ProtobufMarshalAndUnmarshalTest extends CamelTestSupport {
 
@@ -53,7 +57,7 @@ public class ProtobufMarshalAndUnmarshalTest extends 
CamelTestSupport {
             });
             fail("Expect the exception here");
         } catch (Exception ex) {
-            assertTrue("Expect FailedToCreateRouteException", ex instanceof 
FailedToCreateRouteException);
+            assertTrue(ex instanceof FailedToCreateRouteException, "Expect 
FailedToCreateRouteException");
         }
     }
 

Reply via email to