fozzie15 commented on code in PR #34426:
URL: https://github.com/apache/beam/pull/34426#discussion_r2018693841


##########
sdks/java/io/kafka/src/test/java/org/apache/beam/sdk/io/kafka/KafkaReadSchemaTransformProviderTest.java:
##########
@@ -340,4 +346,61 @@ public void testManagedMappings() {
       assertTrue(configSchemaFieldNames.contains(paramName));
     }
   }
+
+  @Test
+  public void testGetRawBytesKvToRowFunction() {
+    Schema testSchema =
+        Schema.builder()
+            .addField("key", Schema.FieldType.BYTES)
+            .addField("value", Schema.FieldType.BYTES)
+            .build();
+
+    SerializableFunction<KV<byte[], byte[]>, Row> kvToRow =
+        
KafkaReadSchemaTransformProvider.getRawBytesKvToRowFunction(testSchema);
+
+    KV<byte[], byte[]> inputKv =
+        KV.of(
+            "testKey".getBytes(StandardCharsets.UTF_8),
+            "testValue".getBytes(StandardCharsets.UTF_8));
+    Row outputRow = kvToRow.apply(inputKv);
+
+    assertEquals("testKey", new String(outputRow.getBytes("key"), 
StandardCharsets.UTF_8));
+    assertEquals("testValue", new String(outputRow.getBytes("value"), 
StandardCharsets.UTF_8));
+  }
+
+  @Test
+  public void testGetRawBytesKvToRowFunctionEmptyKey() {

Review Comment:
   I just saw above comment about ITs. You can add them to KafkaIOIT, where you 
can write a pipeline which triggers your code path as if it were a user's 
pipeline.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to