chia7712 commented on a change in pull request #9520:
URL: https://github.com/apache/kafka/pull/9520#discussion_r549569836



##########
File path: 
connect/api/src/test/java/org/apache/kafka/connect/data/SchemaBuilderTest.java
##########
@@ -293,16 +295,13 @@ public void testEmptyStruct() {
         new Struct(emptyStructSchema);
     }
 
-    @Test(expected = SchemaBuilderException.class)
+    @Test
     public void testDuplicateFields() {
-        final Schema schema = SchemaBuilder.struct()
-                .name("testing")
-                .field("id", SchemaBuilder.string().doc("").build())
-                .field("id", SchemaBuilder.string().doc("").build())
-                .build();
-        final Struct struct = new Struct(schema)
-                .put("id", "testing");
-        struct.validate();
+        assertThrows(SchemaBuilderException.class, () -> SchemaBuilder.struct()
+            .name("testing")
+            .field("id", SchemaBuilder.string().doc("").build())
+            .field("id", SchemaBuilder.string().doc("").build())
+            .build());

Review comment:
       ```StructTest``` has test cases for ```validate``` method.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to