raminqaf commented on code in PR #28561:
URL: https://github.com/apache/flink/pull/28561#discussion_r3505994795


##########
flink-libraries/flink-state-processing-api/src/test/java/org/apache/flink/state/api/output/SnapshotUtilsTest.java:
##########
@@ -33,49 +33,50 @@
 import org.apache.flink.streaming.api.operators.StreamTaskStateInitializer;
 import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
 
-import org.junit.Assert;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
 
+import java.io.File;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 /** Tests that snapshot utils can properly snapshot an operator. */
-public class SnapshotUtilsTest {
+class SnapshotUtilsTest {
 
     private static final List<String> EXPECTED_CALL_OPERATOR_SNAPSHOT =
             Arrays.asList("prepareSnapshotPreBarrier", "snapshotState", 
"notifyCheckpointComplete");
 
-    @Rule public TemporaryFolder folder = new TemporaryFolder();
+    @TempDir private File folder;
 
     private static final List<String> ACTUAL_ORDER_TRACKING =
             Collections.synchronizedList(new 
ArrayList<>(EXPECTED_CALL_OPERATOR_SNAPSHOT.size()));
 
     private static SnapshotType actualSnapshotType;
 
     @Test
-    public void testSnapshotUtilsLifecycleWithDefaultSavepointFormatType() 
throws Exception {
+    void testSnapshotUtilsLifecycleWithDefaultSavepointFormatType() throws 
Exception {
         
testSnapshotUtilsLifecycleWithSavepointFormatType(SavepointFormatType.DEFAULT);
     }
 
     @Test
-    public void testSnapshotUtilsLifecycleWithCanonicalSavepointFormatType() 
throws Exception {
+    void testSnapshotUtilsLifecycleWithCanonicalSavepointFormatType() throws 
Exception {
         
testSnapshotUtilsLifecycleWithSavepointFormatType(SavepointFormatType.CANONICAL);
     }
 
     @Test
-    public void testSnapshotUtilsLifecycleWithNativeSavepointFormatType() 
throws Exception {
+    void testSnapshotUtilsLifecycleWithNativeSavepointFormatType() throws 
Exception {
         
testSnapshotUtilsLifecycleWithSavepointFormatType(SavepointFormatType.NATIVE);
     }
 
     private void testSnapshotUtilsLifecycleWithSavepointFormatType(
             SavepointFormatType savepointFormatType) throws Exception {
         ACTUAL_ORDER_TRACKING.clear();
         StreamOperator<Void> operator = new LifecycleOperator();
-        Path path = new Path(folder.newFolder().getAbsolutePath());
+        Path path = new Path(folder.getAbsolutePath());

Review Comment:
   Why did `.newFolder()` got deleted here?



##########
flink-libraries/flink-state-processing-api/src/test/java/org/apache/flink/state/api/SavepointReaderITTestBase.java:
##########
@@ -168,34 +172,29 @@ private void verifyBroadcastState(String path, 
StreamExecutionEnvironment env)
                         .sorted(Comparator.naturalOrder())
                         .collect(Collectors.toList());
 
-        Assert.assertEquals(
-                "Unexpected element in broadcast state keys",
-                SavepointSource.getElements(),
-                broadcastStateKeys);
-
-        Assert.assertEquals(
-                "Unexpected element in broadcast state values",
-                SavepointSource.getElements().stream()
-                        .map(Object::toString)
-                        .sorted()
-                        .collect(Collectors.toList()),
-                broadcastStateValues);
+        
assertThat(broadcastStateKeys).isEqualTo(SavepointSource.getElements());
+
+        assertThat(broadcastStateValues)
+                .isEqualTo(
+                        SavepointSource.getElements().stream()
+                                .map(Object::toString)
+                                .sorted()
+                                .collect(Collectors.toList()));

Review Comment:
   We can maybe use jUnit5 Api here. Something like:
   ```java
   List<String> expectedValues = SavepointSource.getElements().stream()
           .map(Object::toString)
           .collect(Collectors.toList());
   
   assertThat(broadcastResult)
               .as("Check broadcast state keys")
               .extracting(entry -> entry.f0)
               
.containsExactlyInAnyOrderElementsOf(SavepointSource.getElements());
   
   assertThat(broadcastResult)
               .as("Check broadcast state values")
               .extracting(entry -> entry.f1.toString()) 
               .containsExactlyInAnyOrderElementsOf(expectedValues);
   
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to