You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eventmesh.apache.org by jo...@apache.org on 2022/11/30 06:26:30 UTC
[incubator-eventmesh] branch master updated: add test assert (#2292)
This is an automated email from the ASF dual-hosted git repository.
jonyang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-eventmesh.git
The following commit(s) were added to refs/heads/master by this push:
new a7aaac6b3 add test assert (#2292)
a7aaac6b3 is described below
commit a7aaac6b3f8221e0ce9a5fc256f573528d484285
Author: jonyangx <ya...@gmail.com>
AuthorDate: Wed Nov 30 14:26:24 2022 +0800
add test assert (#2292)
Co-authored-by: jonyangx <jo...@gmail.com>
---
.../knative/consumer/KnativeConsumerImplTest.java | 12 ++++++---
.../knative/producer/KnativeProducerImplTest.java | 30 +++++++++++++---------
2 files changed, 27 insertions(+), 15 deletions(-)
diff --git a/eventmesh-connector-plugin/eventmesh-connector-knative/src/test/java/org/apache/eventmesh/connector/knative/consumer/KnativeConsumerImplTest.java b/eventmesh-connector-plugin/eventmesh-connector-knative/src/test/java/org/apache/eventmesh/connector/knative/consumer/KnativeConsumerImplTest.java
index 69184ea12..e5edc1261 100644
--- a/eventmesh-connector-plugin/eventmesh-connector-knative/src/test/java/org/apache/eventmesh/connector/knative/consumer/KnativeConsumerImplTest.java
+++ b/eventmesh-connector-plugin/eventmesh-connector-knative/src/test/java/org/apache/eventmesh/connector/knative/consumer/KnativeConsumerImplTest.java
@@ -19,6 +19,7 @@ package org.apache.eventmesh.connector.knative.consumer;
import java.util.Properties;
+import org.junit.Assert;
import org.junit.Test;
public class KnativeConsumerImplTest {
@@ -31,9 +32,14 @@ public class KnativeConsumerImplTest {
// Create a Knative consumer:
KnativeConsumerImpl knativeConsumer = new KnativeConsumerImpl();
- knativeConsumer.init(properties);
- // Subscribe:
- knativeConsumer.subscribe(properties.getProperty("topic"));
+ try {
+ knativeConsumer.init(properties);
+
+ // Subscribe:
+ knativeConsumer.subscribe(properties.getProperty("topic"));
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ }
}
}
diff --git a/eventmesh-connector-plugin/eventmesh-connector-knative/src/test/java/org/apache/eventmesh/connector/knative/producer/KnativeProducerImplTest.java b/eventmesh-connector-plugin/eventmesh-connector-knative/src/test/java/org/apache/eventmesh/connector/knative/producer/KnativeProducerImplTest.java
index e81e8fdc3..b2936ca82 100644
--- a/eventmesh-connector-plugin/eventmesh-connector-knative/src/test/java/org/apache/eventmesh/connector/knative/producer/KnativeProducerImplTest.java
+++ b/eventmesh-connector-plugin/eventmesh-connector-knative/src/test/java/org/apache/eventmesh/connector/knative/producer/KnativeProducerImplTest.java
@@ -25,6 +25,7 @@ import org.apache.eventmesh.connector.knative.cloudevent.impl.KnativeHeaders;
import java.util.Properties;
+import org.junit.Assert;
import org.junit.Test;
public class KnativeProducerImplTest {
@@ -42,17 +43,22 @@ public class KnativeProducerImplTest {
// Create a Knative producer:
KnativeProducerImpl knativehProducer = new KnativeProducerImpl();
- knativehProducer.init(properties);
-
- // Publish an event message:
- knativehProducer.publish(KnativeMessageFactory.createWriter(properties), new SendCallback() {
- @Override
- public void onSuccess(SendResult sendResult) {
- }
-
- @Override
- public void onException(OnExceptionContext context) {
- }
- });
+
+ try {
+ knativehProducer.init(properties);
+
+ // Publish an event message:
+ knativehProducer.publish(KnativeMessageFactory.createWriter(properties), new SendCallback() {
+ @Override
+ public void onSuccess(SendResult sendResult) {
+ }
+
+ @Override
+ public void onException(OnExceptionContext context) {
+ }
+ });
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: commits-help@eventmesh.apache.org