kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject [kafka] branch 2.2 updated: HOTFIX: Fix broken connect transform test case due to older junit (#8004)
Date Sat, 25 Jan 2020 00:48:04 GMT
This is an automated email from the ASF dual-hosted git repository.

jgus pushed a commit to branch 2.2
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/2.2 by this push:
     new 15808bf  HOTFIX: Fix broken connect transform test case due to older junit (#8004)
15808bf is described below

commit 15808bfe01faeaff92fe7d499797784f8a815b27
Author: Jason Gustafson <jason@confluent.io>
AuthorDate: Fri Jan 24 16:47:38 2020 -0800

    HOTFIX: Fix broken connect transform test case due to older junit (#8004)
    
    This was broken by https://github.com/apache/kafka/commit/28f013708ffe8e48e46f408c7f570bf2cd5c54b2.
The older branches have an older version of junit.
    
    Reviewers: Ismael Juma <ismael@juma.me.uk>
---
 .../org/apache/kafka/connect/transforms/ValueToKeyTest.java   | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/connect/transforms/src/test/java/org/apache/kafka/connect/transforms/ValueToKeyTest.java
b/connect/transforms/src/test/java/org/apache/kafka/connect/transforms/ValueToKeyTest.java
index 5854658..1894b46 100644
--- a/connect/transforms/src/test/java/org/apache/kafka/connect/transforms/ValueToKeyTest.java
+++ b/connect/transforms/src/test/java/org/apache/kafka/connect/transforms/ValueToKeyTest.java
@@ -21,6 +21,7 @@ import org.apache.kafka.connect.data.SchemaBuilder;
 import org.apache.kafka.connect.data.Struct;
 import org.apache.kafka.connect.errors.DataException;
 import org.apache.kafka.connect.sink.SinkRecord;
+import org.apache.kafka.test.TestUtils;
 import org.junit.After;
 import org.junit.Test;
 
@@ -29,7 +30,7 @@ import java.util.HashMap;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThrows;
+import static org.junit.Assert.fail;
 
 public class ValueToKeyTest {
     private final ValueToKey<SinkRecord> xform = new ValueToKey<>();
@@ -103,7 +104,11 @@ public class ValueToKeyTest {
 
         final SinkRecord record = new SinkRecord("", 0, null, null, valueSchema, value, 0);
 
-        DataException actual = assertThrows(DataException.class, () -> xform.apply(record));
-        assertEquals("Field does not exist: not_exist", actual.getMessage());
+        try {
+            xform.apply(record);
+            fail("Expected exception was not thrown");
+        } catch (DataException e) {
+            assertEquals("Field does not exist: not_exist", e.getMessage());
+        }
     }
 }


Mime
View raw message