Source:
public void testTableSourceWithPattern() { final DataType producedDataType = SOURCE_SCHEMA.toPhysicalRowDataType(); final Map<KafkaTopicPartition, Long> specificOffsets = new HashMap<>(); DecodingFormat<DeserializationSchema<RowData>> decodingFormat = new TestFormatFactory.DecodingFormatMock(",", true); ObjectIdentifier objectIdentifier = ObjectIdentifier.of( "default", "default", "scanTable"); final Map<String, String> modifiedOptions = getModifiedOptions( getFullSourceOptions(), options -> { options.remove("topic"); options.put("topic-pattern", TOPIC_REGEX); options.put("scan.startup.mode", KafkaOptions.SCAN_STARTUP_MODE_VALUE_EARLIEST); options.remove("scan.startup.specific-offsets"); }); CatalogTable catalogTable = createKafkaSourceCatalogTable(modifiedOptions); final DynamicTableSource actualSource = FactoryUtil.createTableSource(null, objectIdentifier, catalogTable, new Configuration(), Thread.currentThread().getContextClassLoader()); final KafkaDynamicSourceBase expectedKafkaSource = getExpectedScanSource( producedDataType, null, Pattern.compile(TOPIC_REGEX), KAFKA_PROPERTIES, decodingFormat, StartupMode.EARLIEST, specificOffsets, 0); final KafkaDynamicSourceBase actualKafkaSource = (KafkaDynamicSourceBase) actualSource; assertEquals(actualKafkaSource, expectedKafkaSource); ScanTableSource.ScanRuntimeProvider provider = actualKafkaSource.getScanRuntimeProvider(ScanRuntimeProviderContext.INSTANCE); assertThat(provider, instanceOf(SourceFunctionProvider.class)); final SourceFunctionProvider sourceFunctionProvider = (SourceFunctionProvider) provider; final SourceFunction<RowData> sourceFunction = sourceFunctionProvider.createSourceFunction(); assertThat(sourceFunction, instanceOf(getExpectedConsumerClass())); assertTrue(((FlinkKafkaConsumerBase) sourceFunction).getEnableCommitOnCheckpoints()); }

Target:
public void testTableSourceWithPattern() { final DataType producedDataType = SOURCE_SCHEMA.toPhysicalRowDataType(); final Map<KafkaTopicPartition, Long> specificOffsets = new HashMap<>(); DecodingFormat<DeserializationSchema<RowData>> decodingFormat = new TestFormatFactory.DecodingFormatMock(",", true); ObjectIdentifier objectIdentifier = ObjectIdentifier.of( "default", "default", "scanTable"); final Map<String, String> modifiedOptions = getModifiedOptions( getFullSourceOptions(), options -> { options.remove("topic"); options.put("topic-pattern", TOPIC_REGEX); options.put("scan.startup.mode", KafkaOptions.SCAN_STARTUP_MODE_VALUE_EARLIEST); options.remove("scan.startup.specific-offsets"); }); CatalogTable catalogTable = createKafkaSourceCatalogTable(modifiedOptions); final DynamicTableSource actualSource = FactoryUtil.createTableSource(null, objectIdentifier, catalogTable, new Configuration(), Thread.currentThread().getContextClassLoader()); final KafkaDynamicSourceBase expectedKafkaSource = getExpectedScanSource( producedDataType, null, Pattern.compile(TOPIC_REGEX), KAFKA_SOURCE_PROPERTIES, decodingFormat, StartupMode.EARLIEST, specificOffsets, 0); final KafkaDynamicSourceBase actualKafkaSource = (KafkaDynamicSourceBase) actualSource; assertEquals(actualKafkaSource, expectedKafkaSource); ScanTableSource.ScanRuntimeProvider provider = actualKafkaSource.getScanRuntimeProvider(ScanRuntimeProviderContext.INSTANCE); assertThat(provider, instanceOf(SourceFunctionProvider.class)); final SourceFunctionProvider sourceFunctionProvider = (SourceFunctionProvider) provider; final SourceFunction<RowData> sourceFunction = sourceFunctionProvider.createSourceFunction(); assertThat(sourceFunction, instanceOf(getExpectedConsumerClass())); }