DenisIstomin commented on a change in pull request #4712:
URL: https://github.com/apache/camel/pull/4712#discussion_r534388473



##########
File path: 
components/camel-azure-storage-blob/src/test/java/org/apache/camel/component/azure/storage/blob/integration/BlobConsumerITTest.java
##########
@@ -128,42 +132,35 @@ void testBatchFilePolling() throws InterruptedException, 
IOException {
             exchange.getIn().setHeader(BlobConstants.BLOB_NAME, 
"test_batch_blob_2");
         });
 
-        // test output stream based
-        final MockEndpoint mockEndpoint = getMockEndpoint("mock:resultBatch");
-        mockEndpoint.expectedMessageCount(2);
-        mockEndpoint.assertIsSatisfied(100);
+        MockEndpoint.assertIsSatisfied(context());
 
         final BlobInputStream blobInputStream = 
mockEndpoint.getExchanges().get(0).getIn().getBody(BlobInputStream.class);
         final BlobInputStream blobInputStream2 = 
mockEndpoint.getExchanges().get(1).getIn().getBody(BlobInputStream.class);
 
         assertNotNull(blobInputStream, "BlobInputStream must be set");
         assertNotNull(blobInputStream2, "BlobInputStream must be set");
 
-        final String bufferedText = new BufferedReader(new 
InputStreamReader(blobInputStream)).readLine();
-        final String bufferedText2 = new BufferedReader(new 
InputStreamReader(blobInputStream2)).readLine();
+        final String bufferedText = 
context().getTypeConverter().convertTo(String.class, blobInputStream);
+        final String bufferedText2 = 
context().getTypeConverter().convertTo(String.class, blobInputStream2);
 
         assertEquals("Block Batch Blob 1", bufferedText);
         assertEquals("Block Batch Blob 2", bufferedText2);
 
-        // test file based
-        final MockEndpoint mockEndpointFile = 
getMockEndpoint("mock:resultBatchFile");
-        mockEndpointFile.expectedMessageCount(2);
-        mockEndpointFile.assertIsSatisfied(100);
-
         final File file = 
mockEndpointFile.getExchanges().get(0).getIn().getBody(File.class);
         final File file2 = 
mockEndpointFile.getExchanges().get(1).getIn().getBody(File.class);
 
         assertNotNull(file, "File must be set");
         assertNotNull(file2, "File must be set");
 
-        assertEquals("Block Batch Blob 1", FileUtils.readFileToString(file, 
Charset.defaultCharset()));
-        assertEquals("Block Batch Blob 2", FileUtils.readFileToString(file2, 
Charset.defaultCharset()));
+        assertEquals("Block Batch Blob 1", 
context().getTypeConverter().convertTo(String.class, file));
+        assertEquals("Block Batch Blob 2", 
context().getTypeConverter().convertTo(String.class, file2));
     }
 
     @Test
-    @Disabled("This test should be fixed to use mock:resultRegex endpoint 
instead of mock:resultBatch")
-    void testRegexPolling() throws InterruptedException {
-        Pattern pattern = Pattern.compile(regex);
+    void testRegexPolling() throws Exception {
+        // test regex based
+        final MockEndpoint mockEndpoint = getMockEndpoint("mock:resultRegex");
+        mockEndpoint.expectedMessageCount(15);

Review comment:
       I think that if `15` will be increased to `16` (or larger number) test 
will still pass.




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

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


Reply via email to