gharris1727 commented on code in PR #13184:
URL: https://github.com/apache/kafka/pull/13184#discussion_r1103287942


##########
connect/runtime/src/test/java/org/apache/kafka/connect/runtime/ConnectorConfigTest.java:
##########
@@ -147,10 +151,10 @@ public void singleTransform() {
         props.put("transforms.a.type", SimpleTransformation.class.getName());
         props.put("transforms.a.magic.number", "42");
         final ConnectorConfig config = new ConnectorConfig(MOCK_PLUGINS, 
props);
-        final List<Transformation<R>> transformations = 
config.transformations();
+        final List<TransformationStage<SinkRecord>> transformations = 
config.transformations();
         assertEquals(1, transformations.size());
-        final SimpleTransformation<R> xform = (SimpleTransformation<R>) 
transformations.get(0);
-        assertEquals(42, xform.magicNumber);
+        final TransformationStage<SinkRecord> xform = transformations.get(0);
+        assertEquals(42, 
xform.apply(DUMMY_RECORD).kafkaPartition().intValue());

Review Comment:
   Both this refactor and a later refactor that I have planned are complicated 
by this sort of testing that depends on the _implementation_ of these classes 
(downcasting and field access). The new style depends on the _behavior_ of the 
configured instances, and works if the implementation details of the 
intermediate classes changes.
   
   While it would be possible to preserve the original style by accessing the 
package-local PredicatedTransform delegate field, that is not possible for the 
next refactor I have planned. Rather than revisiting this test later, I figured 
I would fix it once and avoid the potential merge conflicts.



-- 
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: jira-unsubscr...@kafka.apache.org

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

Reply via email to