yfsn666 commented on code in PR #10818: URL: https://github.com/apache/inlong/pull/10818#discussion_r1726624548
########## inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/TestTransformStringFunctionsProcessor.java: ########## @@ -118,6 +119,20 @@ public void testLocateFunction() throws Exception { Assert.assertEquals(1, output5.size()); Assert.assertEquals(output5.get(0), "result=null"); } + + @Test + public void testReplaceFunction() throws Exception { + String transformSql = "select replace(string1, string2, string3) from source"; + TransformConfig config = new TransformConfig(transformSql); + TransformProcessor<String, String> processor = TransformProcessor + .create(config, SourceDecoderFactory.createCsvDecoder(csvSource), + SinkEncoderFactory.createKvEncoder(kvSink)); + // case1: replace('hooray', 'oray', 'lly') + List<String> output = processor.transform("hooray|oray|lly", new HashMap<>()); + Assert.assertEquals(1, output.size()); + Assert.assertEquals(output.get(0), "result=holly"); + } Review Comment: It is better to add more test cases to cover the common usage scenarios. In this example, you can add a case that string `s` doesn't contains string `s1`. -- 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: commits-unsubscr...@inlong.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org