Source:
<code>public void testXMLReaderWithXMLPreProcessingRequired() throws Exception { <START> String processedFileTable = "XMLTrackingTableXMLPreProcessingRequired"; <END> Map<String, String> sourceProperties = new ImmutableMap.Builder<String, String>() .put(Constants.Reference.REFERENCE_NAME, "XMLReaderXMLPreProcessingRequiredTest") .put("path", sourceFolderUri) .put("nodePath", "/catalog/book/price") .put("targetFolder", targetFolderUri) .put("reprocessingRequired", "Yes") .put("tableName", processedFileTable) .put("actionAfterProcess", "None") .put("tableExpiryPeriod", "30") .build(); ETLStage source = new ETLStage("XMLReader", new ETLPlugin("XMLReader", BatchSource.PLUGIN_TYPE, sourceProperties, null)); String outputDatasetName = "output-batchsink-test-preprocessing-required"; ETLStage sink = new ETLStage("sink", MockSink.getPlugin(outputDatasetName)); ETLBatchConfig etlConfig = ETLBatchConfig.builder("* * * * *") .addStage(source) .addStage(sink) .addConnection(source.getName(), sink.getName()) .build(); AppRequest<ETLBatchConfig> appRequest = new AppRequest<>(ETLBATCH_ARTIFACT, etlConfig); ApplicationId appId = NamespaceId.DEFAULT.app("XMLReaderXMLPreProcessingRequiredTest"); ApplicationManager appManager = deployApplication(appId.toId(), appRequest); Date preProcessedDate = new Date(); createPreProcessedRecord(processedFileTable, preProcessedDate); MapReduceManager mrManager = appManager.getMapReduceManager(ETLMapReduce.NAME); mrManager.start(); mrManager.waitForFinish(5, TimeUnit.MINUTES); List<String> processedFileList = getProcessedFileList(processedFileTable, preProcessedDate); Assert.assertEquals(2, processedFileList.size()); DataSetManager<Table> outputManager = getDataset(outputDatasetName); List<StructuredRecord> output = MockSink.readOutput(outputManager); Assert.assertEquals(12, output.size()); }</code><technical_language>Please check if refactor some common code in this tests a method reduce duplication</technical_language>

Target:
public void testXMLReaderWithXMLPreProcessingRequired() throws Exception { String processedFileTable = "XMLTrackingTableXMLPreProcessingRequired"; Map<String, String> sourceProperties = new ImmutableMap.Builder<String, String>() .put(Constants.Reference.REFERENCE_NAME, "XMLReaderXMLPreProcessingRequiredTest") .put("path", sourceFolderUri) .put("nodePath", "/catalog/book/price") .put("targetFolder", targetFolderUri) .put("reprocessingRequired", "Yes") .put("tableName", processedFileTable) .put("actionAfterProcess", "None") .put("tableExpiryPeriod", "30") .put("temporaryFolder", "/tmp") .build(); String outputDatasetName = "output-batchsink-test-preprocessing-required"; ApplicationManager appManager = deployApplication(sourceProperties, outputDatasetName, "XMLReaderXMLPreProcessingRequiredTest"); Date preProcessedDate = new Date(); createPreProcessedRecord(processedFileTable, preProcessedDate); startMapReduceJob(appManager); List<String> processedFileList = getProcessedFileList(processedFileTable, preProcessedDate); Assert.assertEquals(2, processedFileList.size()); DataSetManager<Table> outputManager = getDataset(outputDatasetName); List<StructuredRecord> output = MockSink.readOutput(outputManager); Assert.assertEquals(12, output.size()); }