orpiske commented on code in PR #11303:
URL: https://github.com/apache/camel/pull/11303#discussion_r1315924629


##########
core/camel-core/src/test/java/org/apache/camel/component/file/FileProducerCharsetUTFtoISOConvertBodyToTest.java:
##########
@@ -35,12 +39,27 @@ class FileProducerCharsetUTFtoISOConvertBodyToTest extends 
ContextTestSupport {
 
     private static final String DATA = "ABC\u00e6";
 
-    @Test
-    void testFileProducerCharsetUTFtoISOConvertBodyTo() throws Exception {
+    @BeforeEach
+    void writeTestData() {
         try (OutputStream fos = Files.newOutputStream(testFile("input.txt"))) {
             fos.write(DATA.getBytes(StandardCharsets.UTF_8));
+        } catch (IOException e) {
+            fail("The test cannot run due to: " + e.getMessage());
         }
+    }
 
+
+    @AfterEach
+    void cleanupFile() {
+        try {
+            Files.delete(testFile("output.txt"));
+        } catch (IOException e) {
+            fail("The test cannot run due to an error cleaning up: " + 
e.getMessage());
+        }
+    }
+
+    @RepeatedTest(10)

Review Comment:
   Yes it is. This test was flaky on some environment. I want to make sure it 
runs well after this change.  



##########
core/camel-core/src/test/java/org/apache/camel/component/file/FileProducerCharsetUTFtoISOConvertBodyToTest.java:
##########
@@ -35,12 +39,27 @@ class FileProducerCharsetUTFtoISOConvertBodyToTest extends 
ContextTestSupport {
 
     private static final String DATA = "ABC\u00e6";
 
-    @Test
-    void testFileProducerCharsetUTFtoISOConvertBodyTo() throws Exception {
+    @BeforeEach
+    void writeTestData() {
         try (OutputStream fos = Files.newOutputStream(testFile("input.txt"))) {
             fos.write(DATA.getBytes(StandardCharsets.UTF_8));
+        } catch (IOException e) {
+            fail("The test cannot run due to: " + e.getMessage());
         }
+    }
 
+
+    @AfterEach
+    void cleanupFile() {
+        try {
+            Files.delete(testFile("output.txt"));
+        } catch (IOException e) {
+            fail("The test cannot run due to an error cleaning up: " + 
e.getMessage());
+        }
+    }
+
+    @RepeatedTest(10)

Review Comment:
   Yes it is. This test was flaky on some of my environments. I want to make 
sure it runs well after this change.  



-- 
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...@camel.apache.org

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

Reply via email to