You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ji...@apache.org on 2024/03/07 11:31:15 UTC

(flink) branch master updated: [FLINK-25544][streaming][JUnit5 Migration] The api package of module flink-stream-java (#24429)

This is an automated email from the ASF dual-hosted git repository.

jiabaosun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/master by this push:
     new 6f7b24817a8 [FLINK-25544][streaming][JUnit5 Migration] The api package of module flink-stream-java (#24429)
6f7b24817a8 is described below

commit 6f7b24817a81995e90cfc2cd77efadb41be8cddc
Author: Jiabao Sun <ji...@apache.org>
AuthorDate: Thu Mar 7 19:31:06 2024 +0800

    [FLINK-25544][streaming][JUnit5 Migration] The api package of module flink-stream-java (#24429)
---
 .../streaming/api/AggregationFunctionTest.java     | 182 ++---
 .../apache/flink/streaming/api/DataStreamTest.java | 861 +++++++++++----------
 .../flink/streaming/api/RestartStrategyTest.java   |  59 +-
 .../flink/streaming/api/SourceFunctionTest.java    |  14 +-
 .../apache/flink/streaming/api/TypeFillTest.java   | 141 ++--
 .../api/checkpoint/ListCheckpointedTest.java       |  22 +-
 .../api/datastream/CoGroupedStreamsTest.java       |  23 +-
 .../datastream/DataStreamSinkDeprecatedTest.java   |  23 +-
 .../api/datastream/DataStreamSinkTest.java         |  23 +-
 .../api/datastream/DataStreamSourceTest.java       |  14 +-
 .../api/datastream/JoinedStreamsTest.java          |  27 +-
 ...treamExecutionEnvironmentConfigurationTest.java |  33 +-
 .../functions/AscendingTimestampExtractorTest.java |  55 +-
 ...oundedOutOfOrdernessTimestampExtractorTest.java |  44 +-
 .../api/functions/FromElementsFunctionTest.java    | 351 ++++-----
 .../api/functions/IngestionTimeExtractorTest.java  |  19 +-
 .../api/functions/PrintSinkFunctionTest.java       |  48 +-
 .../streaming/api/functions/PrintSinkTest.java     |  26 +-
 .../api/functions/StatefulSequenceSourceTest.java  | 175 +----
 .../api/functions/async/RichAsyncFunctionTest.java | 365 ++++-----
 .../sink/OutputFormatSinkFunctionTest.java         |   6 +-
 .../api/functions/sink/SocketClientSinkTest.java   | 148 ++--
 .../api/functions/sink/TransactionHolderTest.java  |  11 +-
 .../sink/TwoPhaseCommitSinkFunctionTest.java       | 127 ++-
 .../sink/filesystem/BucketAssignerTest.java        |  19 +-
 .../sink/filesystem/BucketStateSerializerTest.java | 111 ++-
 .../api/functions/sink/filesystem/BucketTest.java  |  99 ++-
 .../sink/filesystem/BucketsRollingPolicyTest.java  |  45 +-
 .../api/functions/sink/filesystem/BucketsTest.java | 164 ++--
 .../functions/sink/filesystem/BulkWriterTest.java  |  48 +-
 .../filesystem/LocalStreamingFileSinkTest.java     | 136 ++--
 .../api/functions/sink/filesystem/TestUtils.java   |  12 +-
 .../source/ContinuousFileReaderOperatorTest.java   |  62 +-
 .../source/FileMonitoringFunctionTest.java         |   6 +-
 .../source/InputFormatSourceFunctionTest.java      |  63 +-
 .../source/SocketTextStreamFunctionTest.java       |  21 +-
 .../source/datagen/DataGeneratorSourceTest.java    |  27 +-
 .../delta/extractor/ArrayFromTupleTest.java        |  22 +-
 .../delta/extractor/ConcatenatedExtractTest.java   |  34 +-
 .../delta/extractor/FieldFromArrayTest.java        |  27 +-
 .../delta/extractor/FieldFromTupleTest.java        |  17 +-
 .../delta/extractor/FieldsFromArrayTest.java       |  39 +-
 .../delta/extractor/FieldsFromTupleTest.java       |  19 +-
 .../SinkTransformationTranslatorITCaseBase.java    |  80 +-
 .../SinkV1TransformationTranslatorITCase.java      |  53 +-
 ...V2TransformationTranslatorDeprecatedITCase.java |  31 +-
 .../SinkV2TransformationTranslatorITCase.java      |  31 +-
 .../streaming/api/graph/SlotAllocationTest.java    | 150 ++--
 .../StreamGraphGeneratorBatchExecutionTest.java    | 213 +++--
 ...amGraphGeneratorExecutionModeDetectionTest.java | 185 ++---
 .../api/graph/StreamGraphGeneratorTest.java        | 279 +++----
 .../api/graph/StreamingJobGraphGeneratorTest.java  |   5 +-
 ...hGeneratorWithGlobalStreamExchangeModeTest.java |  91 +--
 .../api/operators/AbstractStreamOperatorTest.java  | 100 ++-
 .../operators/AbstractStreamOperatorV2Test.java    |  15 +-
 .../AbstractUdfStreamOperatorLifecycleTest.java    |  64 +-
 .../operators/BackendRestorerProcedureTest.java    |  40 +-
 .../operators/BatchGroupedReduceOperatorTest.java  |  25 +-
 .../api/operators/InputSelectionTest.java          | 198 ++---
 .../InternalTimeServiceManagerImplTest.java        |  23 +-
 .../operators/InternalTimerServiceImplTest.java    | 242 +++---
 .../api/operators/KeyedProcessOperatorTest.java    |  47 +-
 .../operators/LegacyKeyedProcessOperatorTest.java  |  38 +-
 .../api/operators/OperatorAttributesTest.java      |   4 +-
 .../operators/OperatorSnapshotFinalizerTest.java   |  31 +-
 .../api/operators/OperatorSnapshotFuturesTest.java |  13 +-
 .../api/operators/ProcessOperatorTest.java         |  23 +-
 .../api/operators/SourceOperatorIdleTest.java      |  29 +-
 .../SourceOperatorSplitWatermarkAlignmentTest.java |   6 +-
 .../api/operators/SourceOperatorTest.java          |  94 +--
 .../api/operators/StateDescriptorPassingTest.java  |  38 +-
 .../StateInitializationContextImplTest.java        |  51 +-
 .../StateSnapshotContextSynchronousImplTest.java   |  49 +-
 .../streaming/api/operators/StreamFilterTest.java  |  30 +-
 .../streaming/api/operators/StreamFlatMapTest.java |  30 +-
 .../operators/StreamGroupedReduceOperatorTest.java |  30 +-
 .../streaming/api/operators/StreamMapTest.java     |  30 +-
 .../operators/StreamOperatorStateHandlerTest.java  | 101 ++-
 .../streaming/api/operators/StreamProjectTest.java |   6 +-
 .../api/operators/StreamSinkOperatorTest.java      |  33 +-
 .../StreamSourceContextIdleDetectionTests.java     |  67 +-
 .../StreamTaskStateInitializerImplTest.java        |  79 +-
 .../api/operators/StreamingRuntimeContextTest.java |  71 +-
 .../WrappingFunctionSnapshotRestoreTest.java       |  23 +-
 .../api/operators/async/AsyncWaitOperatorTest.java | 132 ++--
 .../async/queue/OrderedStreamElementQueueTest.java |  27 +-
 .../api/operators/async/queue/QueueUtil.java       |   7 +-
 .../async/queue/StreamElementQueueTest.java        |  77 +-
 .../queue/UnorderedStreamElementQueueTest.java     |  53 +-
 .../co/CoBroadcastWithKeyedOperatorTest.java       | 100 ++-
 .../co/CoBroadcastWithNonKeyedOperatorTest.java    |  97 ++-
 .../api/operators/co/CoProcessOperatorTest.java    |   9 +-
 .../api/operators/co/CoStreamFlatMapTest.java      |  35 +-
 .../api/operators/co/CoStreamMapTest.java          |  34 +-
 .../api/operators/co/IntervalJoinOperatorTest.java | 137 ++--
 .../operators/co/KeyedCoProcessOperatorTest.java   |  33 +-
 .../co/LegacyKeyedCoProcessOperatorTest.java       |  30 +-
 .../operators/collect/CollectResultBufferTest.java |  64 +-
 .../collect/CollectResultIteratorTest.java         |  37 +-
 .../collect/CollectSinkFunctionRandomITCase.java   |  14 +-
 .../operators/collect/CollectSinkFunctionTest.java |   7 +-
 .../AbstractTestCoordinationRequestHandler.java    |  11 +-
 .../utils/CollectSinkFunctionTestWrapper.java      |   6 +-
 .../operators/collect/utils/CollectTestUtils.java  |  23 +-
 .../api/operators/collect/utils/TestJobClient.java |   6 +-
 .../sort/FixedLengthKeyAndValueSerializerTest.java |   4 +-
 .../sort/LargeSortingDataInputITCase.java          |  26 +-
 .../sort/MultiInputSortingDataInputsTest.java      | 104 ++-
 .../api/operators/sort/SortingDataInputTest.java   |  69 +-
 .../VariableLengthKeyAndValueSerializerTest.java   |   4 +-
 .../BatchExecutionInternalTimeServiceTest.java     | 126 +--
 .../state/BatchExecutionStateBackendTest.java      | 320 ++++----
 ...BatchExecutionStateBackendVerificationTest.java |  31 +-
 .../source/SourceOutputWithWatermarksTest.java     |  25 +-
 .../source/WatermarkToDataOutputTest.java          |  25 +-
 .../functions/InternalWindowFunctionTest.java      |  24 +-
 .../api/streamtask/StreamIterationHeadTest.java    |  12 +-
 .../deltafunction/CosineDistanceTest.java          |  24 +-
 .../deltafunction/EuclideanDistanceTest.java       |  24 +-
 .../streaming/util/BlockingSourceContext.java      | 101 +++
 .../org.junit.jupiter.api.extension.Extension      |  16 +
 121 files changed, 3979 insertions(+), 4411 deletions(-)

diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/AggregationFunctionTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/AggregationFunctionTest.java
index a108ca721b7..e163e8a63d8 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/AggregationFunctionTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/AggregationFunctionTest.java
@@ -36,19 +36,19 @@ import org.apache.flink.streaming.util.keys.KeySelectorUtil;
 
 import org.apache.flink.shaded.guava31.com.google.common.collect.ImmutableList;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
 
-import static org.junit.Assert.assertEquals;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /** Tests for {@link AggregationFunction}. */
-public class AggregationFunctionTest {
+class AggregationFunctionTest {
 
     @Test
-    public void groupSumIntegerTest() throws Exception {
+    void groupSumIntegerTest() throws Exception {
 
         // preparing expected outputs
         List<Tuple2<Integer, Integer>> expectedGroupSumList = new ArrayList<>();
@@ -124,13 +124,13 @@ public class AggregationFunctionTest {
                         keySelector,
                         keyType);
 
-        assertEquals(expectedGroupSumList, groupedSumList);
-        assertEquals(expectedGroupMinList, groupedMinList);
-        assertEquals(expectedGroupMaxList, groupedMaxList);
+        assertThat(groupedSumList).isEqualTo(expectedGroupSumList);
+        assertThat(groupedMinList).isEqualTo(expectedGroupMinList);
+        assertThat(groupedMaxList).isEqualTo(expectedGroupMaxList);
     }
 
     @Test
-    public void pojoGroupSumIntegerTest() throws Exception {
+    void pojoGroupSumIntegerTest() throws Exception {
 
         // preparing expected outputs
         List<MyPojo> expectedGroupSumList = new ArrayList<>();
@@ -204,13 +204,13 @@ public class AggregationFunctionTest {
                         keySelector,
                         keyType);
 
-        assertEquals(expectedGroupSumList, groupedSumList);
-        assertEquals(expectedGroupMinList, groupedMinList);
-        assertEquals(expectedGroupMaxList, groupedMaxList);
+        assertThat(groupedSumList).isEqualTo(expectedGroupSumList);
+        assertThat(groupedMinList).isEqualTo(expectedGroupMinList);
+        assertThat(groupedMaxList).isEqualTo(expectedGroupMaxList);
     }
 
     @Test
-    public void minMaxByTest() throws Exception {
+    void minMaxByTest() throws Exception {
         // Tuples are grouped on field 0, aggregated on field 1
 
         // preparing expected outputs
@@ -283,49 +283,49 @@ public class AggregationFunctionTest {
         ReduceFunction<Tuple3<Integer, Integer, Integer>> minByFunctionLast =
                 new ComparableAggregator<>(1, typeInfo, AggregationType.MINBY, false, config);
 
-        assertEquals(
-                maxByFirstExpected,
-                MockContext.createAndExecuteForKeyedStream(
-                        new StreamGroupedReduceOperator<>(
-                                maxByFunctionFirst,
-                                typeInfo.createSerializer(config.getSerializerConfig())),
-                        getInputByList(),
-                        keySelector,
-                        keyType));
-
-        assertEquals(
-                maxByLastExpected,
-                MockContext.createAndExecuteForKeyedStream(
-                        new StreamGroupedReduceOperator<>(
-                                maxByFunctionLast,
-                                typeInfo.createSerializer(config.getSerializerConfig())),
-                        getInputByList(),
-                        keySelector,
-                        keyType));
-
-        assertEquals(
-                minByLastExpected,
-                MockContext.createAndExecuteForKeyedStream(
-                        new StreamGroupedReduceOperator<>(
-                                minByFunctionLast,
-                                typeInfo.createSerializer(config.getSerializerConfig())),
-                        getInputByList(),
-                        keySelector,
-                        keyType));
-
-        assertEquals(
-                minByFirstExpected,
-                MockContext.createAndExecuteForKeyedStream(
-                        new StreamGroupedReduceOperator<>(
-                                minByFunctionFirst,
-                                typeInfo.createSerializer(config.getSerializerConfig())),
-                        getInputByList(),
-                        keySelector,
-                        keyType));
+        assertThat(
+                        MockContext.createAndExecuteForKeyedStream(
+                                new StreamGroupedReduceOperator<>(
+                                        maxByFunctionFirst,
+                                        typeInfo.createSerializer(config.getSerializerConfig())),
+                                getInputByList(),
+                                keySelector,
+                                keyType))
+                .isEqualTo(maxByFirstExpected);
+
+        assertThat(
+                        MockContext.createAndExecuteForKeyedStream(
+                                new StreamGroupedReduceOperator<>(
+                                        maxByFunctionLast,
+                                        typeInfo.createSerializer(config.getSerializerConfig())),
+                                getInputByList(),
+                                keySelector,
+                                keyType))
+                .isEqualTo(maxByLastExpected);
+
+        assertThat(
+                        MockContext.createAndExecuteForKeyedStream(
+                                new StreamGroupedReduceOperator<>(
+                                        minByFunctionLast,
+                                        typeInfo.createSerializer(config.getSerializerConfig())),
+                                getInputByList(),
+                                keySelector,
+                                keyType))
+                .isEqualTo(minByLastExpected);
+
+        assertThat(
+                        MockContext.createAndExecuteForKeyedStream(
+                                new StreamGroupedReduceOperator<>(
+                                        minByFunctionFirst,
+                                        typeInfo.createSerializer(config.getSerializerConfig())),
+                                getInputByList(),
+                                keySelector,
+                                keyType))
+                .isEqualTo(minByFirstExpected);
     }
 
     @Test
-    public void pojoMinMaxByTest() throws Exception {
+    void pojoMinMaxByTest() throws Exception {
         // Pojos are grouped on field 0, aggregated on field 1
 
         // preparing expected outputs
@@ -397,45 +397,45 @@ public class AggregationFunctionTest {
         ReduceFunction<MyPojo3> minByFunctionLast =
                 new ComparableAggregator<>("f1", typeInfo, AggregationType.MINBY, false, config);
 
-        assertEquals(
-                maxByFirstExpected,
-                MockContext.createAndExecuteForKeyedStream(
-                        new StreamGroupedReduceOperator<>(
-                                maxByFunctionFirst,
-                                typeInfo.createSerializer(config.getSerializerConfig())),
-                        getInputByPojoList(),
-                        keySelector,
-                        keyType));
-
-        assertEquals(
-                maxByLastExpected,
-                MockContext.createAndExecuteForKeyedStream(
-                        new StreamGroupedReduceOperator<>(
-                                maxByFunctionLast,
-                                typeInfo.createSerializer(config.getSerializerConfig())),
-                        getInputByPojoList(),
-                        keySelector,
-                        keyType));
-
-        assertEquals(
-                minByLastExpected,
-                MockContext.createAndExecuteForKeyedStream(
-                        new StreamGroupedReduceOperator<>(
-                                minByFunctionLast,
-                                typeInfo.createSerializer(config.getSerializerConfig())),
-                        getInputByPojoList(),
-                        keySelector,
-                        keyType));
-
-        assertEquals(
-                minByFirstExpected,
-                MockContext.createAndExecuteForKeyedStream(
-                        new StreamGroupedReduceOperator<>(
-                                minByFunctionFirst,
-                                typeInfo.createSerializer(config.getSerializerConfig())),
-                        getInputByPojoList(),
-                        keySelector,
-                        keyType));
+        assertThat(
+                        MockContext.createAndExecuteForKeyedStream(
+                                new StreamGroupedReduceOperator<>(
+                                        maxByFunctionFirst,
+                                        typeInfo.createSerializer(config.getSerializerConfig())),
+                                getInputByPojoList(),
+                                keySelector,
+                                keyType))
+                .isEqualTo(maxByFirstExpected);
+
+        assertThat(
+                        MockContext.createAndExecuteForKeyedStream(
+                                new StreamGroupedReduceOperator<>(
+                                        maxByFunctionLast,
+                                        typeInfo.createSerializer(config.getSerializerConfig())),
+                                getInputByPojoList(),
+                                keySelector,
+                                keyType))
+                .isEqualTo(maxByLastExpected);
+
+        assertThat(
+                        MockContext.createAndExecuteForKeyedStream(
+                                new StreamGroupedReduceOperator<>(
+                                        minByFunctionLast,
+                                        typeInfo.createSerializer(config.getSerializerConfig())),
+                                getInputByPojoList(),
+                                keySelector,
+                                keyType))
+                .isEqualTo(minByLastExpected);
+
+        assertThat(
+                        MockContext.createAndExecuteForKeyedStream(
+                                new StreamGroupedReduceOperator<>(
+                                        minByFunctionFirst,
+                                        typeInfo.createSerializer(config.getSerializerConfig())),
+                                getInputByPojoList(),
+                                keySelector,
+                                keyType))
+                .isEqualTo(minByFirstExpected);
     }
 
     // *************************************************************************
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/DataStreamTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/DataStreamTest.java
index 6b75b1d2ee7..9245912d13b 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/DataStreamTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/DataStreamTest.java
@@ -83,13 +83,8 @@ import org.apache.flink.streaming.runtime.partitioner.RebalancePartitioner;
 import org.apache.flink.streaming.runtime.partitioner.ShufflePartitioner;
 import org.apache.flink.streaming.runtime.partitioner.StreamPartitioner;
 import org.apache.flink.util.Collector;
-import org.apache.flink.util.TestLogger;
 
-import org.hamcrest.core.StringStartsWith;
-import org.junit.Assert;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
 
 import javax.annotation.Nullable;
 
@@ -97,23 +92,17 @@ import java.lang.reflect.Method;
 import java.time.Duration;
 import java.util.List;
 
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.assertj.core.api.Assertions.fail;
 
 /** Tests for {@link DataStream}. */
 @SuppressWarnings("serial")
-public class DataStreamTest extends TestLogger {
-
-    @Rule public ExpectedException expectedException = ExpectedException.none();
+class DataStreamTest {
 
     /** Ensure that WatermarkStrategy is easy to use in the API, without superfluous generics. */
     @Test
-    public void testErgonomicWatermarkStrategy() {
+    void testErgonomicWatermarkStrategy() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         DataStream<String> input = env.fromData("bonjour");
@@ -135,7 +124,7 @@ public class DataStreamTest extends TestLogger {
      * @throws Exception
      */
     @Test
-    public void testUnion() throws Exception {
+    void testUnion() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
         env.setParallelism(4);
 
@@ -250,15 +239,14 @@ public class DataStreamTest extends TestLogger {
         StreamGraph streamGraph = getStreamGraph(env);
 
         // verify self union
-        assertTrue(streamGraph.getStreamNode(selfUnion.getId()).getInEdges().size() == 2);
+        assertThat(streamGraph.getStreamNode(selfUnion.getId()).getInEdges()).hasSize(2);
         for (StreamEdge edge : streamGraph.getStreamNode(selfUnion.getId()).getInEdges()) {
-            assertTrue(edge.getPartitioner() instanceof ForwardPartitioner);
+            assertThat(edge.getPartitioner()).isInstanceOf(ForwardPartitioner.class);
         }
 
         // verify self union with different partitioners
-        assertTrue(
-                streamGraph.getStreamNode(selfUnionDifferentPartition.getId()).getInEdges().size()
-                        == 2);
+        assertThat(streamGraph.getStreamNode(selfUnionDifferentPartition.getId()).getInEdges())
+                .hasSize(2);
         boolean hasForward = false;
         boolean hasBroadcast = false;
         for (StreamEdge edge :
@@ -270,33 +258,31 @@ public class DataStreamTest extends TestLogger {
                 hasBroadcast = true;
             }
         }
-        assertTrue(hasForward && hasBroadcast);
+        assertThat(hasForward && hasBroadcast).isTrue();
 
         // verify union of streams with differing parallelism
-        assertTrue(
-                streamGraph.getStreamNode(unionDifferingParallelism.getId()).getInEdges().size()
-                        == 2);
+        assertThat(streamGraph.getStreamNode(unionDifferingParallelism.getId()).getInEdges())
+                .hasSize(2);
         for (StreamEdge edge :
                 streamGraph.getStreamNode(unionDifferingParallelism.getId()).getInEdges()) {
             if (edge.getSourceId() == input2.getId()) {
-                assertTrue(edge.getPartitioner() instanceof ForwardPartitioner);
+                assertThat(edge.getPartitioner()).isInstanceOf(ForwardPartitioner.class);
             } else if (edge.getSourceId() == input3.getId()) {
-                assertTrue(edge.getPartitioner() instanceof RebalancePartitioner);
+                assertThat(edge.getPartitioner()).isInstanceOf(RebalancePartitioner.class);
             } else {
                 fail("Wrong input edge.");
             }
         }
 
         // verify union of streams with differing partitionings
-        assertTrue(
-                streamGraph.getStreamNode(unionDifferingPartitioning.getId()).getInEdges().size()
-                        == 2);
+        assertThat(streamGraph.getStreamNode(unionDifferingPartitioning.getId()).getInEdges())
+                .hasSize(2);
         for (StreamEdge edge :
                 streamGraph.getStreamNode(unionDifferingPartitioning.getId()).getInEdges()) {
             if (edge.getSourceId() == input4.getId()) {
-                assertTrue(edge.getPartitioner() instanceof BroadcastPartitioner);
+                assertThat(edge.getPartitioner()).isInstanceOf(BroadcastPartitioner.class);
             } else if (edge.getSourceId() == input5.getId()) {
-                assertTrue(edge.getPartitioner() instanceof ForwardPartitioner);
+                assertThat(edge.getPartitioner()).isInstanceOf(ForwardPartitioner.class);
             } else {
                 fail("Wrong input edge.");
             }
@@ -309,7 +295,7 @@ public class DataStreamTest extends TestLogger {
      * @throws Exception
      */
     @Test
-    public void testNaming() throws Exception {
+    void testNaming() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         DataStream<Long> dataStream1 =
@@ -367,12 +353,12 @@ public class DataStreamTest extends TestLogger {
         // test functionality through the operator names in the execution plan
         String plan = env.getExecutionPlan();
 
-        assertTrue(plan.contains("testSource1"));
-        assertTrue(plan.contains("testSource2"));
-        assertTrue(plan.contains("testMap"));
-        assertTrue(plan.contains("testMap"));
-        assertTrue(plan.contains("testCoFlatMap"));
-        assertTrue(plan.contains("testWindowReduce"));
+        assertThat(plan).contains("testSource1");
+        assertThat(plan).contains("testSource2");
+        assertThat(plan).contains("testMap");
+        assertThat(plan).contains("testMap");
+        assertThat(plan).contains("testCoFlatMap");
+        assertThat(plan).contains("testWindowReduce");
     }
 
     /**
@@ -380,7 +366,7 @@ public class DataStreamTest extends TestLogger {
      * result in different and correct topologies. Does the some for the {@link ConnectedStreams}.
      */
     @Test
-    public void testPartitioning() {
+    void testPartitioning() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         DataStream<Tuple2<Long, Long>> src1 = env.fromData(new Tuple2<>(0L, 0L));
@@ -398,15 +384,19 @@ public class DataStreamTest extends TestLogger {
         int id3 = createDownStreamId(group3);
         int id4 = createDownStreamId(group4);
 
-        assertTrue(isPartitioned(getStreamGraph(env).getStreamEdgesOrThrow(src1.getId(), id1)));
-        assertTrue(isPartitioned(getStreamGraph(env).getStreamEdgesOrThrow(src1.getId(), id2)));
-        assertTrue(isPartitioned(getStreamGraph(env).getStreamEdgesOrThrow(src1.getId(), id3)));
-        assertTrue(isPartitioned(getStreamGraph(env).getStreamEdgesOrThrow(src1.getId(), id4)));
+        assertThat(isPartitioned(getStreamGraph(env).getStreamEdgesOrThrow(src1.getId(), id1)))
+                .isTrue();
+        assertThat(isPartitioned(getStreamGraph(env).getStreamEdgesOrThrow(src1.getId(), id2)))
+                .isTrue();
+        assertThat(isPartitioned(getStreamGraph(env).getStreamEdgesOrThrow(src1.getId(), id3)))
+                .isTrue();
+        assertThat(isPartitioned(getStreamGraph(env).getStreamEdgesOrThrow(src1.getId(), id4)))
+                .isTrue();
 
-        assertTrue(isKeyed(group1));
-        assertTrue(isKeyed(group2));
-        assertTrue(isKeyed(group3));
-        assertTrue(isKeyed(group4));
+        assertThat(isKeyed(group1)).isTrue();
+        assertThat(isKeyed(group2)).isTrue();
+        assertThat(isKeyed(group3)).isTrue();
+        assertThat(isKeyed(group4)).isTrue();
 
         // Testing DataStream partitioning
         DataStream<Tuple2<Long, Long>> partition1 = src1.keyBy(0);
@@ -419,15 +409,19 @@ public class DataStreamTest extends TestLogger {
         int pid3 = createDownStreamId(partition3);
         int pid4 = createDownStreamId(partition4);
 
-        assertTrue(isPartitioned(getStreamGraph(env).getStreamEdgesOrThrow(src1.getId(), pid1)));
-        assertTrue(isPartitioned(getStreamGraph(env).getStreamEdgesOrThrow(src1.getId(), pid2)));
-        assertTrue(isPartitioned(getStreamGraph(env).getStreamEdgesOrThrow(src1.getId(), pid3)));
-        assertTrue(isPartitioned(getStreamGraph(env).getStreamEdgesOrThrow(src1.getId(), pid4)));
+        assertThat(isPartitioned(getStreamGraph(env).getStreamEdgesOrThrow(src1.getId(), pid1)))
+                .isTrue();
+        assertThat(isPartitioned(getStreamGraph(env).getStreamEdgesOrThrow(src1.getId(), pid2)))
+                .isTrue();
+        assertThat(isPartitioned(getStreamGraph(env).getStreamEdgesOrThrow(src1.getId(), pid3)))
+                .isTrue();
+        assertThat(isPartitioned(getStreamGraph(env).getStreamEdgesOrThrow(src1.getId(), pid4)))
+                .isTrue();
 
-        assertTrue(isKeyed(partition1));
-        assertTrue(isKeyed(partition3));
-        assertTrue(isKeyed(partition2));
-        assertTrue(isKeyed(partition4));
+        assertThat(isKeyed(partition1)).isTrue();
+        assertThat(isKeyed(partition3)).isTrue();
+        assertThat(isKeyed(partition2)).isTrue();
+        assertThat(isKeyed(partition4)).isTrue();
 
         // Testing DataStream custom partitioning
         Partitioner<Long> longPartitioner =
@@ -448,16 +442,22 @@ public class DataStreamTest extends TestLogger {
         int cid2 = createDownStreamId(customPartition3);
         int cid3 = createDownStreamId(customPartition4);
 
-        assertTrue(
-                isCustomPartitioned(getStreamGraph(env).getStreamEdgesOrThrow(src1.getId(), cid1)));
-        assertTrue(
-                isCustomPartitioned(getStreamGraph(env).getStreamEdgesOrThrow(src1.getId(), cid2)));
-        assertTrue(
-                isCustomPartitioned(getStreamGraph(env).getStreamEdgesOrThrow(src1.getId(), cid3)));
-
-        assertFalse(isKeyed(customPartition1));
-        assertFalse(isKeyed(customPartition3));
-        assertFalse(isKeyed(customPartition4));
+        assertThat(
+                        isCustomPartitioned(
+                                getStreamGraph(env).getStreamEdgesOrThrow(src1.getId(), cid1)))
+                .isTrue();
+        assertThat(
+                        isCustomPartitioned(
+                                getStreamGraph(env).getStreamEdgesOrThrow(src1.getId(), cid2)))
+                .isTrue();
+        assertThat(
+                        isCustomPartitioned(
+                                getStreamGraph(env).getStreamEdgesOrThrow(src1.getId(), cid3)))
+                .isTrue();
+
+        assertThat(isKeyed(customPartition1)).isFalse();
+        assertThat(isKeyed(customPartition3)).isFalse();
+        assertThat(isKeyed(customPartition4)).isFalse();
 
         // Testing ConnectedStreams grouping
         ConnectedStreams<Tuple2<Long, Long>, Tuple2<Long, Long>> connectedGroup1 =
@@ -480,46 +480,66 @@ public class DataStreamTest extends TestLogger {
                 connected.keyBy(new FirstSelector(), new FirstSelector());
         Integer downStreamId5 = createDownStreamId(connectedGroup5);
 
-        assertTrue(
-                isPartitioned(
-                        getStreamGraph(env).getStreamEdgesOrThrow(src1.getId(), downStreamId1)));
-        assertTrue(
-                isPartitioned(
-                        getStreamGraph(env).getStreamEdgesOrThrow(src2.getId(), downStreamId1)));
-
-        assertTrue(
-                isPartitioned(
-                        getStreamGraph(env).getStreamEdgesOrThrow(src1.getId(), downStreamId2)));
-        assertTrue(
-                isPartitioned(
-                        getStreamGraph(env).getStreamEdgesOrThrow(src2.getId(), downStreamId2)));
-
-        assertTrue(
-                isPartitioned(
-                        getStreamGraph(env).getStreamEdgesOrThrow(src1.getId(), downStreamId3)));
-        assertTrue(
-                isPartitioned(
-                        getStreamGraph(env).getStreamEdgesOrThrow(src2.getId(), downStreamId3)));
-
-        assertTrue(
-                isPartitioned(
-                        getStreamGraph(env).getStreamEdgesOrThrow(src1.getId(), downStreamId4)));
-        assertTrue(
-                isPartitioned(
-                        getStreamGraph(env).getStreamEdgesOrThrow(src2.getId(), downStreamId4)));
-
-        assertTrue(
-                isPartitioned(
-                        getStreamGraph(env).getStreamEdgesOrThrow(src1.getId(), downStreamId5)));
-        assertTrue(
-                isPartitioned(
-                        getStreamGraph(env).getStreamEdgesOrThrow(src2.getId(), downStreamId5)));
-
-        assertTrue(isKeyed(connectedGroup1));
-        assertTrue(isKeyed(connectedGroup2));
-        assertTrue(isKeyed(connectedGroup3));
-        assertTrue(isKeyed(connectedGroup4));
-        assertTrue(isKeyed(connectedGroup5));
+        assertThat(
+                        isPartitioned(
+                                getStreamGraph(env)
+                                        .getStreamEdgesOrThrow(src1.getId(), downStreamId1)))
+                .isTrue();
+        assertThat(
+                        isPartitioned(
+                                getStreamGraph(env)
+                                        .getStreamEdgesOrThrow(src2.getId(), downStreamId1)))
+                .isTrue();
+
+        assertThat(
+                        isPartitioned(
+                                getStreamGraph(env)
+                                        .getStreamEdgesOrThrow(src1.getId(), downStreamId2)))
+                .isTrue();
+        assertThat(
+                        isPartitioned(
+                                getStreamGraph(env)
+                                        .getStreamEdgesOrThrow(src2.getId(), downStreamId2)))
+                .isTrue();
+
+        assertThat(
+                        isPartitioned(
+                                getStreamGraph(env)
+                                        .getStreamEdgesOrThrow(src1.getId(), downStreamId3)))
+                .isTrue();
+        assertThat(
+                        isPartitioned(
+                                getStreamGraph(env)
+                                        .getStreamEdgesOrThrow(src2.getId(), downStreamId3)))
+                .isTrue();
+
+        assertThat(
+                        isPartitioned(
+                                getStreamGraph(env)
+                                        .getStreamEdgesOrThrow(src1.getId(), downStreamId4)))
+                .isTrue();
+        assertThat(
+                        isPartitioned(
+                                getStreamGraph(env)
+                                        .getStreamEdgesOrThrow(src2.getId(), downStreamId4)))
+                .isTrue();
+
+        assertThat(
+                        isPartitioned(
+                                getStreamGraph(env)
+                                        .getStreamEdgesOrThrow(src1.getId(), downStreamId5)))
+                .isTrue();
+        assertThat(
+                        isPartitioned(
+                                getStreamGraph(env)
+                                        .getStreamEdgesOrThrow(src2.getId(), downStreamId5)))
+                .isTrue();
+
+        assertThat(isKeyed(connectedGroup1)).isTrue();
+        assertThat(isKeyed(connectedGroup2)).isTrue();
+        assertThat(isKeyed(connectedGroup3)).isTrue();
+        assertThat(isKeyed(connectedGroup4)).isTrue();
+        assertThat(isKeyed(connectedGroup5)).isTrue();
 
         // Testing ConnectedStreams partitioning
         ConnectedStreams<Tuple2<Long, Long>, Tuple2<Long, Long>> connectedPartition1 =
@@ -542,61 +562,71 @@ public class DataStreamTest extends TestLogger {
                 connected.keyBy(new FirstSelector(), new FirstSelector());
         Integer connectDownStreamId5 = createDownStreamId(connectedPartition5);
 
-        assertTrue(
-                isPartitioned(
-                        getStreamGraph(env)
-                                .getStreamEdgesOrThrow(src1.getId(), connectDownStreamId1)));
-        assertTrue(
-                isPartitioned(
-                        getStreamGraph(env)
-                                .getStreamEdgesOrThrow(src2.getId(), connectDownStreamId1)));
-
-        assertTrue(
-                isPartitioned(
-                        getStreamGraph(env)
-                                .getStreamEdgesOrThrow(src1.getId(), connectDownStreamId2)));
-        assertTrue(
-                isPartitioned(
-                        getStreamGraph(env)
-                                .getStreamEdgesOrThrow(src2.getId(), connectDownStreamId2)));
-
-        assertTrue(
-                isPartitioned(
-                        getStreamGraph(env)
-                                .getStreamEdgesOrThrow(src1.getId(), connectDownStreamId3)));
-        assertTrue(
-                isPartitioned(
-                        getStreamGraph(env)
-                                .getStreamEdgesOrThrow(src2.getId(), connectDownStreamId3)));
-
-        assertTrue(
-                isPartitioned(
-                        getStreamGraph(env)
-                                .getStreamEdgesOrThrow(src1.getId(), connectDownStreamId4)));
-        assertTrue(
-                isPartitioned(
-                        getStreamGraph(env)
-                                .getStreamEdgesOrThrow(src2.getId(), connectDownStreamId4)));
-
-        assertTrue(
-                isPartitioned(
-                        getStreamGraph(env)
-                                .getStreamEdgesOrThrow(src1.getId(), connectDownStreamId5)));
-        assertTrue(
-                isPartitioned(
-                        getStreamGraph(env)
-                                .getStreamEdgesOrThrow(src2.getId(), connectDownStreamId5)));
-
-        assertTrue(isKeyed(connectedPartition1));
-        assertTrue(isKeyed(connectedPartition2));
-        assertTrue(isKeyed(connectedPartition3));
-        assertTrue(isKeyed(connectedPartition4));
-        assertTrue(isKeyed(connectedPartition5));
+        assertThat(
+                        isPartitioned(
+                                getStreamGraph(env)
+                                        .getStreamEdgesOrThrow(src1.getId(), connectDownStreamId1)))
+                .isTrue();
+        assertThat(
+                        isPartitioned(
+                                getStreamGraph(env)
+                                        .getStreamEdgesOrThrow(src2.getId(), connectDownStreamId1)))
+                .isTrue();
+
+        assertThat(
+                        isPartitioned(
+                                getStreamGraph(env)
+                                        .getStreamEdgesOrThrow(src1.getId(), connectDownStreamId2)))
+                .isTrue();
+        assertThat(
+                        isPartitioned(
+                                getStreamGraph(env)
+                                        .getStreamEdgesOrThrow(src2.getId(), connectDownStreamId2)))
+                .isTrue();
+
+        assertThat(
+                        isPartitioned(
+                                getStreamGraph(env)
+                                        .getStreamEdgesOrThrow(src1.getId(), connectDownStreamId3)))
+                .isTrue();
+        assertThat(
+                        isPartitioned(
+                                getStreamGraph(env)
+                                        .getStreamEdgesOrThrow(src2.getId(), connectDownStreamId3)))
+                .isTrue();
+
+        assertThat(
+                        isPartitioned(
+                                getStreamGraph(env)
+                                        .getStreamEdgesOrThrow(src1.getId(), connectDownStreamId4)))
+                .isTrue();
+        assertThat(
+                        isPartitioned(
+                                getStreamGraph(env)
+                                        .getStreamEdgesOrThrow(src2.getId(), connectDownStreamId4)))
+                .isTrue();
+
+        assertThat(
+                        isPartitioned(
+                                getStreamGraph(env)
+                                        .getStreamEdgesOrThrow(src1.getId(), connectDownStreamId5)))
+                .isTrue();
+        assertThat(
+                        isPartitioned(
+                                getStreamGraph(env)
+                                        .getStreamEdgesOrThrow(src2.getId(), connectDownStreamId5)))
+                .isTrue();
+
+        assertThat(isKeyed(connectedPartition1)).isTrue();
+        assertThat(isKeyed(connectedPartition2)).isTrue();
+        assertThat(isKeyed(connectedPartition3)).isTrue();
+        assertThat(isKeyed(connectedPartition4)).isTrue();
+        assertThat(isKeyed(connectedPartition5)).isTrue();
     }
 
     /** Tests whether parallelism gets set. */
     @Test
-    public void testParallelism() {
+    void testParallelism() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         DataStreamSource<Tuple2<Long, Long>> src = env.fromData(new Tuple2<>(0L, 0L));
@@ -634,50 +664,52 @@ public class DataStreamTest extends TestLogger {
                             public void invoke(Long value) throws Exception {}
                         });
 
-        assertEquals(1, getStreamGraph(env).getStreamNode(src.getId()).getParallelism());
-        assertEquals(10, getStreamGraph(env).getStreamNode(map.getId()).getParallelism());
-        assertEquals(1, getStreamGraph(env).getStreamNode(windowed.getId()).getParallelism());
-        assertEquals(
-                10,
-                getStreamGraph(env)
-                        .getStreamNode(sink.getTransformation().getId())
-                        .getParallelism());
+        assertThat(getStreamGraph(env).getStreamNode(src.getId()).getParallelism()).isOne();
+        assertThat(getStreamGraph(env).getStreamNode(map.getId()).getParallelism()).isEqualTo(10);
+        assertThat(getStreamGraph(env).getStreamNode(windowed.getId()).getParallelism()).isOne();
+        assertThat(
+                        getStreamGraph(env)
+                                .getStreamNode(sink.getTransformation().getId())
+                                .getParallelism())
+                .isEqualTo(10);
 
         env.setParallelism(7);
 
         // Some parts, such as windowing rely on the fact that previous operators have a parallelism
         // set when instantiating the Discretizer. This would break if we dynamically changed
         // the parallelism of operations when changing the setting on the Execution Environment.
-        assertEquals(1, getStreamGraph(env).getStreamNode(src.getId()).getParallelism());
-        assertEquals(10, getStreamGraph(env).getStreamNode(map.getId()).getParallelism());
-        assertEquals(1, getStreamGraph(env).getStreamNode(windowed.getId()).getParallelism());
-        assertEquals(
-                10,
-                getStreamGraph(env)
-                        .getStreamNode(sink.getTransformation().getId())
-                        .getParallelism());
+        assertThat(getStreamGraph(env).getStreamNode(src.getId()).getParallelism()).isOne();
+        assertThat(getStreamGraph(env).getStreamNode(map.getId()).getParallelism()).isEqualTo(10);
+        assertThat(getStreamGraph(env).getStreamNode(windowed.getId()).getParallelism()).isOne();
+        assertThat(
+                        getStreamGraph(env)
+                                .getStreamNode(sink.getTransformation().getId())
+                                .getParallelism())
+                .isEqualTo(10);
 
         DataStreamSource<Long> parallelSource = env.fromSequence(0, 0);
         parallelSource.sinkTo(new DiscardingSink<Long>());
-        assertEquals(7, getStreamGraph(env).getStreamNode(parallelSource.getId()).getParallelism());
+        assertThat(getStreamGraph(env).getStreamNode(parallelSource.getId()).getParallelism())
+                .isEqualTo(7);
 
         parallelSource.setParallelism(3);
-        assertEquals(3, getStreamGraph(env).getStreamNode(parallelSource.getId()).getParallelism());
+        assertThat(getStreamGraph(env).getStreamNode(parallelSource.getId()).getParallelism())
+                .isEqualTo(3);
 
         map.setParallelism(2);
-        assertEquals(2, getStreamGraph(env).getStreamNode(map.getId()).getParallelism());
+        assertThat(getStreamGraph(env).getStreamNode(map.getId()).getParallelism()).isEqualTo(2);
 
         sink.setParallelism(4);
-        assertEquals(
-                4,
-                getStreamGraph(env)
-                        .getStreamNode(sink.getTransformation().getId())
-                        .getParallelism());
+        assertThat(
+                        getStreamGraph(env)
+                                .getStreamNode(sink.getTransformation().getId())
+                                .getParallelism())
+                .isEqualTo(4);
     }
 
     /** Tests whether resources get set. */
     @Test
-    public void testResources() throws Exception {
+    void testResources() throws Exception {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         ResourceSpec minResource1 = ResourceSpec.newBuilder(1.0, 100).build();
@@ -769,62 +801,54 @@ public class DataStreamTest extends TestLogger {
         DataStreamSink<Long> sink = windowed.print();
         sinkMethod.invoke(sink, minResource7, preferredResource7);
 
-        assertEquals(
-                minResource1, getStreamGraph(env).getStreamNode(source1.getId()).getMinResources());
-        assertEquals(
-                preferredResource1,
-                getStreamGraph(env).getStreamNode(source1.getId()).getPreferredResources());
-
-        assertEquals(
-                minResource2, getStreamGraph(env).getStreamNode(map1.getId()).getMinResources());
-        assertEquals(
-                preferredResource2,
-                getStreamGraph(env).getStreamNode(map1.getId()).getPreferredResources());
-
-        assertEquals(
-                minResource3, getStreamGraph(env).getStreamNode(source2.getId()).getMinResources());
-        assertEquals(
-                preferredResource3,
-                getStreamGraph(env).getStreamNode(source2.getId()).getPreferredResources());
-
-        assertEquals(
-                minResource4, getStreamGraph(env).getStreamNode(map2.getId()).getMinResources());
-        assertEquals(
-                preferredResource4,
-                getStreamGraph(env).getStreamNode(map2.getId()).getPreferredResources());
-
-        assertEquals(
-                minResource5,
-                getStreamGraph(env).getStreamNode(connected.getId()).getMinResources());
-        assertEquals(
-                preferredResource5,
-                getStreamGraph(env).getStreamNode(connected.getId()).getPreferredResources());
-
-        assertEquals(
-                minResource6,
-                getStreamGraph(env).getStreamNode(windowed.getId()).getMinResources());
-        assertEquals(
-                preferredResource6,
-                getStreamGraph(env).getStreamNode(windowed.getId()).getPreferredResources());
-
-        assertEquals(
-                minResource7,
-                getStreamGraph(env)
-                        .getStreamNode(sink.getTransformation().getId())
-                        .getMinResources());
-        assertEquals(
-                preferredResource7,
-                getStreamGraph(env)
-                        .getStreamNode(sink.getTransformation().getId())
-                        .getPreferredResources());
+        assertThat(getStreamGraph(env).getStreamNode(source1.getId()).getMinResources())
+                .isEqualTo(minResource1);
+        assertThat(getStreamGraph(env).getStreamNode(source1.getId()).getPreferredResources())
+                .isEqualTo(preferredResource1);
+
+        assertThat(getStreamGraph(env).getStreamNode(map1.getId()).getMinResources())
+                .isEqualTo(minResource2);
+        assertThat(getStreamGraph(env).getStreamNode(map1.getId()).getPreferredResources())
+                .isEqualTo(preferredResource2);
+
+        assertThat(getStreamGraph(env).getStreamNode(source2.getId()).getMinResources())
+                .isEqualTo(minResource3);
+        assertThat(getStreamGraph(env).getStreamNode(source2.getId()).getPreferredResources())
+                .isEqualTo(preferredResource3);
+
+        assertThat(getStreamGraph(env).getStreamNode(map2.getId()).getMinResources())
+                .isEqualTo(minResource4);
+        assertThat(getStreamGraph(env).getStreamNode(map2.getId()).getPreferredResources())
+                .isEqualTo(preferredResource4);
+
+        assertThat(getStreamGraph(env).getStreamNode(connected.getId()).getMinResources())
+                .isEqualTo(minResource5);
+        assertThat(getStreamGraph(env).getStreamNode(connected.getId()).getPreferredResources())
+                .isEqualTo(preferredResource5);
+
+        assertThat(getStreamGraph(env).getStreamNode(windowed.getId()).getMinResources())
+                .isEqualTo(minResource6);
+        assertThat(getStreamGraph(env).getStreamNode(windowed.getId()).getPreferredResources())
+                .isEqualTo(preferredResource6);
+
+        assertThat(
+                        getStreamGraph(env)
+                                .getStreamNode(sink.getTransformation().getId())
+                                .getMinResources())
+                .isEqualTo(minResource7);
+        assertThat(
+                        getStreamGraph(env)
+                                .getStreamNode(sink.getTransformation().getId())
+                                .getPreferredResources())
+                .isEqualTo(preferredResource7);
     }
 
     @Test
-    public void testTypeInfo() {
+    void testTypeInfo() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         DataStream<Long> src1 = env.fromSequence(0, 0);
-        assertEquals(TypeExtractor.getForClass(Long.class), src1.getType());
+        assertThat(src1.getType()).isEqualTo(TypeExtractor.getForClass(Long.class));
 
         DataStream<Tuple2<Integer, String>> map =
                 src1.map(
@@ -835,7 +859,7 @@ public class DataStreamTest extends TestLogger {
                             }
                         });
 
-        assertEquals(TypeExtractor.getForObject(new Tuple2<>(0, "")), map.getType());
+        assertThat(map.getType()).isEqualTo(TypeExtractor.getForObject(new Tuple2<>(0, "")));
 
         DataStream<String> window =
                 map.windowAll(GlobalWindows.create())
@@ -851,7 +875,7 @@ public class DataStreamTest extends TestLogger {
                                             throws Exception {}
                                 });
 
-        assertEquals(TypeExtractor.getForClass(String.class), window.getType());
+        assertThat(window.getType()).isEqualTo(TypeExtractor.getForClass(String.class));
 
         DataStream<CustomPOJO> flatten =
                 window.windowAll(GlobalWindows.create())
@@ -881,7 +905,7 @@ public class DataStreamTest extends TestLogger {
                                     }
                                 });
 
-        assertEquals(TypeExtractor.getForClass(CustomPOJO.class), flatten.getType());
+        assertThat(flatten.getType()).isEqualTo(TypeExtractor.getForClass(CustomPOJO.class));
     }
 
     /**
@@ -890,7 +914,7 @@ public class DataStreamTest extends TestLogger {
      */
     @Test
     @Deprecated
-    public void testKeyedStreamProcessTranslation() {
+    void testKeyedStreamProcessTranslation() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
         DataStreamSource<Long> src = env.fromSequence(0, 0);
 
@@ -916,8 +940,9 @@ public class DataStreamTest extends TestLogger {
 
         processed.sinkTo(new DiscardingSink<Integer>());
 
-        assertEquals(processFunction, getFunctionForDataStream(processed));
-        assertTrue(getOperatorForDataStream(processed) instanceof LegacyKeyedProcessOperator);
+        assertThat(getFunctionForDataStream(processed)).isEqualTo(processFunction);
+        assertThat(getOperatorForDataStream(processed))
+                .isInstanceOf(LegacyKeyedProcessOperator.class);
     }
 
     /**
@@ -925,7 +950,7 @@ public class DataStreamTest extends TestLogger {
      * to an operator.
      */
     @Test
-    public void testKeyedStreamKeyedProcessTranslation() {
+    void testKeyedStreamKeyedProcessTranslation() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
         DataStreamSource<Long> src = env.fromSequence(0, 0);
 
@@ -951,8 +976,8 @@ public class DataStreamTest extends TestLogger {
 
         processed.sinkTo(new DiscardingSink<Integer>());
 
-        assertEquals(keyedProcessFunction, getFunctionForDataStream(processed));
-        assertTrue(getOperatorForDataStream(processed) instanceof KeyedProcessOperator);
+        assertThat(getFunctionForDataStream(processed)).isEqualTo(keyedProcessFunction);
+        assertThat(getOperatorForDataStream(processed)).isInstanceOf(KeyedProcessOperator.class);
     }
 
     /**
@@ -960,7 +985,7 @@ public class DataStreamTest extends TestLogger {
      * operator.
      */
     @Test
-    public void testProcessTranslation() {
+    void testProcessTranslation() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
         DataStreamSource<Long> src = env.fromSequence(0, 0);
 
@@ -985,8 +1010,8 @@ public class DataStreamTest extends TestLogger {
 
         processed.sinkTo(new DiscardingSink<Integer>());
 
-        assertEquals(processFunction, getFunctionForDataStream(processed));
-        assertTrue(getOperatorForDataStream(processed) instanceof ProcessOperator);
+        assertThat(getFunctionForDataStream(processed)).isEqualTo(processFunction);
+        assertThat(getOperatorForDataStream(processed)).isInstanceOf(ProcessOperator.class);
     }
 
     /**
@@ -994,7 +1019,7 @@ public class DataStreamTest extends TestLogger {
      * KeyedBroadcastProcessFunction}.
      */
     @Test
-    public void testFailedTranslationOnKeyed() {
+    void testFailedTranslationOnKeyed() {
 
         final MapStateDescriptor<Long, String> descriptor =
                 new MapStateDescriptor<>(
@@ -1028,27 +1053,32 @@ public class DataStreamTest extends TestLogger {
         BroadcastStream<String> broadcast = srcTwo.broadcast(descriptor);
         BroadcastConnectedStream<Long, String> bcStream = srcOne.connect(broadcast);
 
-        expectedException.expect(IllegalArgumentException.class);
-        bcStream.process(
-                new BroadcastProcessFunction<Long, String, String>() {
-                    @Override
-                    public void processBroadcastElement(
-                            String value, Context ctx, Collector<String> out) throws Exception {
-                        // do nothing
-                    }
-
-                    @Override
-                    public void processElement(
-                            Long value, ReadOnlyContext ctx, Collector<String> out)
-                            throws Exception {
-                        // do nothing
-                    }
-                });
+        assertThatThrownBy(
+                        () ->
+                                bcStream.process(
+                                        new BroadcastProcessFunction<Long, String, String>() {
+                                            @Override
+                                            public void processBroadcastElement(
+                                                    String value,
+                                                    Context ctx,
+                                                    Collector<String> out) {
+                                                // do nothing
+                                            }
+
+                                            @Override
+                                            public void processElement(
+                                                    Long value,
+                                                    ReadOnlyContext ctx,
+                                                    Collector<String> out) {
+                                                // do nothing
+                                            }
+                                        }))
+                .isInstanceOf(IllegalArgumentException.class);
     }
 
     /** Tests that with a non-keyed stream we have to provide a {@link BroadcastProcessFunction}. */
     @Test
-    public void testFailedTranslationOnNonKeyed() {
+    void testFailedTranslationOnNonKeyed() {
 
         final MapStateDescriptor<Long, String> descriptor =
                 new MapStateDescriptor<>(
@@ -1081,27 +1111,33 @@ public class DataStreamTest extends TestLogger {
         BroadcastStream<String> broadcast = srcTwo.broadcast(descriptor);
         BroadcastConnectedStream<Long, String> bcStream = srcOne.connect(broadcast);
 
-        expectedException.expect(IllegalArgumentException.class);
-        bcStream.process(
-                new KeyedBroadcastProcessFunction<String, Long, String, String>() {
-                    @Override
-                    public void processBroadcastElement(
-                            String value, Context ctx, Collector<String> out) throws Exception {
-                        // do nothing
-                    }
-
-                    @Override
-                    public void processElement(
-                            Long value, ReadOnlyContext ctx, Collector<String> out)
-                            throws Exception {
-                        // do nothing
-                    }
-                });
+        assertThatThrownBy(
+                        () ->
+                                bcStream.process(
+                                        new KeyedBroadcastProcessFunction<
+                                                String, Long, String, String>() {
+                                            @Override
+                                            public void processBroadcastElement(
+                                                    String value,
+                                                    Context ctx,
+                                                    Collector<String> out) {
+                                                // do nothing
+                                            }
+
+                                            @Override
+                                            public void processElement(
+                                                    Long value,
+                                                    ReadOnlyContext ctx,
+                                                    Collector<String> out) {
+                                                // do nothing
+                                            }
+                                        }))
+                .isInstanceOf(IllegalArgumentException.class);
     }
 
     /** Tests that verifies window operator has different name and description. */
     @Test
-    public void testWindowOperatorDescription() {
+    void testWindowOperatorDescription() {
         // global window
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
         DataStream<Long> dataStream1 =
@@ -1118,13 +1154,13 @@ public class DataStreamTest extends TestLogger {
                                     }
                                 });
         // name is simplified
-        assertEquals("GlobalWindows", dataStream1.getTransformation().getName());
+        assertThat(dataStream1.getTransformation().getName()).isEqualTo("GlobalWindows");
         // description contains detail of function:
         // TriggerWindow(GlobalWindows(), ReducingStateDescriptor{name=window-contents,
         // defaultValue=null,
         // serializer=org.apache.flink.api.common.typeutils.base.LongSerializer@6af9fcb2},
         // PurgingTrigger(CountTrigger(10)), AllWindowedStream.reduce(AllWindowedStream.java:229))
-        assertTrue(dataStream1.getTransformation().getDescription().contains("PurgingTrigger"));
+        assertThat(dataStream1.getTransformation().getDescription()).contains("PurgingTrigger");
 
         // keyed window
         DataStream<Long> dataStream2 =
@@ -1142,11 +1178,11 @@ public class DataStreamTest extends TestLogger {
                                     }
                                 });
         // name is simplified
-        assertEquals("TumblingEventTimeWindows", dataStream2.getTransformation().getName());
+        assertThat(dataStream2.getTransformation().getName()).isEqualTo("TumblingEventTimeWindows");
         // description contains detail of function:
         // Window(TumblingEventTimeWindows(1000), PurgingTrigger, ReduceFunction$36,
         // PassThroughWindowFunction)
-        assertTrue(dataStream2.getTransformation().getDescription().contains("PurgingTrigger"));
+        assertThat(dataStream2.getTransformation().getDescription()).contains("PurgingTrigger");
     }
 
     /**
@@ -1155,7 +1191,7 @@ public class DataStreamTest extends TestLogger {
      * @throws Exception
      */
     @Test
-    public void testUserDefinedDescription() {
+    void testUserDefinedDescription() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         DataStream<Long> dataStream1 =
@@ -1219,12 +1255,13 @@ public class DataStreamTest extends TestLogger {
         // test functionality through the operator names in the execution plan
         String plan = env.getExecutionPlan();
 
-        assertTrue(plan.contains("this is test source 1"));
-        assertTrue(plan.contains("this is test source 2"));
-        assertTrue(plan.contains("this is test map 1"));
-        assertTrue(plan.contains("this is test map 2"));
-        assertTrue(plan.contains("this is test co flat map"));
-        assertTrue(plan.contains("this is test window reduce"));
+        assertThat(plan)
+                .contains(
+                        "this is test source 1",
+                        "this is test map 1",
+                        "this is test map 2",
+                        "this is test co flat map",
+                        "this is test window reduce");
     }
 
     private abstract static class CustomWmEmitter<T>
@@ -1238,7 +1275,7 @@ public class DataStreamTest extends TestLogger {
     }
 
     @Test
-    public void operatorTest() {
+    void operatorTest() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         DataStreamSource<Long> src = env.fromSequence(0, 0);
@@ -1252,7 +1289,7 @@ public class DataStreamTest extends TestLogger {
                 };
         DataStream<Integer> map = src.map(mapFunction);
         map.sinkTo(new DiscardingSink<Integer>());
-        assertEquals(mapFunction, getFunctionForDataStream(map));
+        assertThat(getFunctionForDataStream(map)).isEqualTo(mapFunction);
 
         FlatMapFunction<Long, Integer> flatMapFunction =
                 new FlatMapFunction<Long, Integer>() {
@@ -1263,7 +1300,7 @@ public class DataStreamTest extends TestLogger {
                 };
         DataStream<Integer> flatMap = src.flatMap(flatMapFunction);
         flatMap.sinkTo(new DiscardingSink<Integer>());
-        assertEquals(flatMapFunction, getFunctionForDataStream(flatMap));
+        assertThat(getFunctionForDataStream(flatMap)).isEqualTo(flatMapFunction);
 
         FilterFunction<Integer> filterFunction =
                 new FilterFunction<Integer>() {
@@ -1277,19 +1314,10 @@ public class DataStreamTest extends TestLogger {
 
         unionFilter.sinkTo(new DiscardingSink<Integer>());
 
-        assertEquals(filterFunction, getFunctionForDataStream(unionFilter));
-
-        try {
-            getStreamGraph(env).getStreamEdgesOrThrow(map.getId(), unionFilter.getId());
-        } catch (RuntimeException e) {
-            fail(e.getMessage());
-        }
+        assertThat(getFunctionForDataStream(unionFilter)).isEqualTo(filterFunction);
 
-        try {
-            getStreamGraph(env).getStreamEdgesOrThrow(flatMap.getId(), unionFilter.getId());
-        } catch (RuntimeException e) {
-            fail(e.getMessage());
-        }
+        getStreamGraph(env).getStreamEdgesOrThrow(map.getId(), unionFilter.getId());
+        getStreamGraph(env).getStreamEdgesOrThrow(flatMap.getId(), unionFilter.getId());
 
         ConnectedStreams<Integer, Integer> connect = map.connect(flatMap);
         CoMapFunction<Integer, Integer, String> coMapper =
@@ -1308,23 +1336,14 @@ public class DataStreamTest extends TestLogger {
                 };
         DataStream<String> coMap = connect.map(coMapper);
         coMap.sinkTo(new DiscardingSink<String>());
-        assertEquals(coMapper, getFunctionForDataStream(coMap));
-
-        try {
-            getStreamGraph(env).getStreamEdgesOrThrow(map.getId(), coMap.getId());
-        } catch (RuntimeException e) {
-            fail(e.getMessage());
-        }
+        assertThat(getFunctionForDataStream(coMap)).isEqualTo(coMapper);
 
-        try {
-            getStreamGraph(env).getStreamEdgesOrThrow(flatMap.getId(), coMap.getId());
-        } catch (RuntimeException e) {
-            fail(e.getMessage());
-        }
+        getStreamGraph(env).getStreamEdgesOrThrow(map.getId(), coMap.getId());
+        getStreamGraph(env).getStreamEdgesOrThrow(flatMap.getId(), coMap.getId());
     }
 
     @Test
-    public void testKeyedConnectedStreamsType() {
+    void testKeyedConnectedStreamsType() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         DataStreamSource<Integer> stream1 = env.fromData(1, 2);
@@ -1335,28 +1354,28 @@ public class DataStreamTest extends TestLogger {
 
         KeyedStream<?, ?> firstKeyedInput = (KeyedStream<?, ?>) connectedStreams.getFirstInput();
         KeyedStream<?, ?> secondKeyedInput = (KeyedStream<?, ?>) connectedStreams.getSecondInput();
-        assertThat(firstKeyedInput.getKeyType(), equalTo(Types.INT));
-        assertThat(secondKeyedInput.getKeyType(), equalTo(Types.INT));
+        assertThat(firstKeyedInput.getKeyType()).isEqualTo(Types.INT);
+        assertThat(secondKeyedInput.getKeyType()).isEqualTo(Types.INT);
     }
 
     @Test
-    public void sinkKeyTest() {
+    void sinkKeyTest() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         DataStreamSink<Long> sink = env.fromSequence(1, 100).print();
-        assertEquals(
-                0,
-                getStreamGraph(env)
-                        .getStreamNode(sink.getTransformation().getId())
-                        .getStatePartitioners()
-                        .length);
-        assertTrue(
-                getStreamGraph(env)
+        assertThat(
+                        getStreamGraph(env)
+                                .getStreamNode(sink.getTransformation().getId())
+                                .getStatePartitioners()
+                                .length)
+                .isZero();
+        assertThat(
+                        getStreamGraph(env)
                                 .getStreamNode(sink.getTransformation().getId())
                                 .getInEdges()
                                 .get(0)
-                                .getPartitioner()
-                        instanceof ForwardPartitioner);
+                                .getPartitioner())
+                .isInstanceOf(ForwardPartitioner.class);
 
         KeySelector<Long, Long> key1 =
                 new KeySelector<Long, Long>() {
@@ -1371,32 +1390,34 @@ public class DataStreamTest extends TestLogger {
 
         DataStreamSink<Long> sink2 = env.fromSequence(1, 100).keyBy(key1).print();
 
-        assertEquals(
-                1,
-                getStreamGraph(env)
-                        .getStreamNode(sink2.getTransformation().getId())
-                        .getStatePartitioners()
-                        .length);
-        assertNotNull(
-                getStreamGraph(env)
-                        .getStreamNode(sink2.getTransformation().getId())
-                        .getStateKeySerializer());
-        assertNotNull(
-                getStreamGraph(env)
-                        .getStreamNode(sink2.getTransformation().getId())
-                        .getStateKeySerializer());
-        assertEquals(
-                key1,
-                getStreamGraph(env)
-                        .getStreamNode(sink2.getTransformation().getId())
-                        .getStatePartitioners()[0]);
-        assertTrue(
-                getStreamGraph(env)
+        assertThat(
+                        getStreamGraph(env)
+                                .getStreamNode(sink2.getTransformation().getId())
+                                .getStatePartitioners()
+                                .length)
+                .isOne();
+        assertThat(
+                        getStreamGraph(env)
+                                .getStreamNode(sink2.getTransformation().getId())
+                                .getStateKeySerializer())
+                .isNotNull();
+        assertThat(
+                        getStreamGraph(env)
+                                .getStreamNode(sink2.getTransformation().getId())
+                                .getStateKeySerializer())
+                .isNotNull();
+        assertThat(
+                        getStreamGraph(env)
+                                .getStreamNode(sink2.getTransformation().getId())
+                                .getStatePartitioners()[0])
+                .isEqualTo(key1);
+        assertThat(
+                        getStreamGraph(env)
                                 .getStreamNode(sink2.getTransformation().getId())
                                 .getInEdges()
                                 .get(0)
-                                .getPartitioner()
-                        instanceof KeyGroupStreamPartitioner);
+                                .getPartitioner())
+                .isInstanceOf(KeyGroupStreamPartitioner.class);
 
         KeySelector<Long, Long> key2 =
                 new KeySelector<Long, Long>() {
@@ -1411,28 +1432,28 @@ public class DataStreamTest extends TestLogger {
 
         DataStreamSink<Long> sink3 = env.fromSequence(1, 100).keyBy(key2).print();
 
-        assertEquals(
-                1,
-                getStreamGraph(env)
-                        .getStreamNode(sink3.getTransformation().getId())
-                        .getStatePartitioners()
-                        .length);
-        assertEquals(
-                key2,
-                getStreamGraph(env)
-                        .getStreamNode(sink3.getTransformation().getId())
-                        .getStatePartitioners()[0]);
-        assertTrue(
-                getStreamGraph(env)
+        assertThat(
+                        getStreamGraph(env)
+                                .getStreamNode(sink3.getTransformation().getId())
+                                .getStatePartitioners()
+                                .length)
+                .isOne();
+        assertThat(
+                        getStreamGraph(env)
+                                .getStreamNode(sink3.getTransformation().getId())
+                                .getStatePartitioners()[0])
+                .isEqualTo(key2);
+        assertThat(
+                        getStreamGraph(env)
                                 .getStreamNode(sink3.getTransformation().getId())
                                 .getInEdges()
                                 .get(0)
-                                .getPartitioner()
-                        instanceof KeyGroupStreamPartitioner);
+                                .getPartitioner())
+                .isInstanceOf(KeyGroupStreamPartitioner.class);
     }
 
     @Test
-    public void testChannelSelectors() {
+    void testChannelSelectors() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         DataStreamSource<Long> src = env.fromSequence(0, 0);
@@ -1444,7 +1465,7 @@ public class DataStreamTest extends TestLogger {
                         .getStreamEdges(src.getId(), broadcastSink.getTransformation().getId())
                         .get(0)
                         .getPartitioner();
-        assertTrue(broadcastPartitioner instanceof BroadcastPartitioner);
+        assertThat(broadcastPartitioner).isInstanceOf(BroadcastPartitioner.class);
 
         DataStream<Long> shuffle = src.shuffle();
         DataStreamSink<Long> shuffleSink = shuffle.print();
@@ -1453,7 +1474,7 @@ public class DataStreamTest extends TestLogger {
                         .getStreamEdges(src.getId(), shuffleSink.getTransformation().getId())
                         .get(0)
                         .getPartitioner();
-        assertTrue(shufflePartitioner instanceof ShufflePartitioner);
+        assertThat(shufflePartitioner).isInstanceOf(ShufflePartitioner.class);
 
         DataStream<Long> forward = src.forward();
         DataStreamSink<Long> forwardSink = forward.print();
@@ -1462,7 +1483,7 @@ public class DataStreamTest extends TestLogger {
                         .getStreamEdges(src.getId(), forwardSink.getTransformation().getId())
                         .get(0)
                         .getPartitioner();
-        assertTrue(forwardPartitioner instanceof ForwardPartitioner);
+        assertThat(forwardPartitioner).isInstanceOf(ForwardPartitioner.class);
 
         DataStream<Long> rebalance = src.rebalance();
         DataStreamSink<Long> rebalanceSink = rebalance.print();
@@ -1471,7 +1492,7 @@ public class DataStreamTest extends TestLogger {
                         .getStreamEdges(src.getId(), rebalanceSink.getTransformation().getId())
                         .get(0)
                         .getPartitioner();
-        assertTrue(rebalancePartitioner instanceof RebalancePartitioner);
+        assertThat(rebalancePartitioner).isInstanceOf(RebalancePartitioner.class);
 
         DataStream<Long> global = src.global();
         DataStreamSink<Long> globalSink = global.print();
@@ -1480,7 +1501,7 @@ public class DataStreamTest extends TestLogger {
                         .getStreamEdges(src.getId(), globalSink.getTransformation().getId())
                         .get(0)
                         .getPartitioner();
-        assertTrue(globalPartitioner instanceof GlobalPartitioner);
+        assertThat(globalPartitioner).isInstanceOf(GlobalPartitioner.class);
     }
 
     /////////////////////////////////////////////////////////////
@@ -1488,7 +1509,7 @@ public class DataStreamTest extends TestLogger {
     /////////////////////////////////////////////////////////////
 
     @Test
-    public void testPrimitiveArrayKeyRejection() {
+    void testPrimitiveArrayKeyRejection() {
 
         KeySelector<Tuple2<Integer[], String>, int[]> keySelector =
                 new KeySelector<Tuple2<Integer[], String>, int[]>() {
@@ -1507,7 +1528,7 @@ public class DataStreamTest extends TestLogger {
     }
 
     @Test
-    public void testBasicArrayKeyRejection() {
+    void testBasicArrayKeyRejection() {
 
         KeySelector<Tuple2<Integer[], String>, Integer[]> keySelector =
                 new KeySelector<Tuple2<Integer[], String>, Integer[]>() {
@@ -1522,7 +1543,7 @@ public class DataStreamTest extends TestLogger {
     }
 
     @Test
-    public void testObjectArrayKeyRejection() {
+    void testObjectArrayKeyRejection() {
 
         KeySelector<Tuple2<Integer[], String>, Object[]> keySelector =
                 new KeySelector<Tuple2<Integer[], String>, Object[]>() {
@@ -1551,19 +1572,17 @@ public class DataStreamTest extends TestLogger {
         DataStream<Tuple2<Integer[], String>> input =
                 env.fromData(new Tuple2<>(new Integer[] {1, 2}, "barfoo"));
 
-        Assert.assertEquals(
-                expectedKeyType, TypeExtractor.getKeySelectorTypes(keySelector, input.getType()));
+        assertThat(TypeExtractor.getKeySelectorTypes(keySelector, input.getType()))
+                .isEqualTo(expectedKeyType);
 
         // adjust the rule
-        expectedException.expect(InvalidProgramException.class);
-        expectedException.expectMessage(
-                new StringStartsWith("Type " + expectedKeyType + " cannot be used as key."));
-
-        input.keyBy(keySelector);
+        assertThatThrownBy(() -> input.keyBy(keySelector))
+                .isInstanceOf(InvalidProgramException.class)
+                .hasMessageStartingWith("Type " + expectedKeyType + " cannot be used as key.");
     }
 
     @Test
-    public void testEnumKeyRejection() {
+    void testEnumKeyRejection() {
         KeySelector<Tuple2<TestEnum, String>, TestEnum> keySelector = value -> value.f0;
 
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
@@ -1571,18 +1590,16 @@ public class DataStreamTest extends TestLogger {
         DataStream<Tuple2<TestEnum, String>> input =
                 env.fromData(Tuple2.of(TestEnum.FOO, "Foo"), Tuple2.of(TestEnum.BAR, "Bar"));
 
-        expectedException.expect(InvalidProgramException.class);
-        expectedException.expectMessage(
-                new StringStartsWith(
-                        "Type " + EnumTypeInfo.of(TestEnum.class) + " cannot be used as key."));
-
-        input.keyBy(keySelector);
+        assertThatThrownBy(() -> input.keyBy(keySelector))
+                .isInstanceOf(InvalidProgramException.class)
+                .hasMessageStartingWith(
+                        "Type " + EnumTypeInfo.of(TestEnum.class) + " cannot be used as key.");
     }
 
     ////////////////			Composite Key Tests : POJOs			////////////////
 
     @Test
-    public void testPOJOWithNestedArrayNoHashCodeKeyRejection() {
+    void testPOJOWithNestedArrayNoHashCodeKeyRejection() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         DataStream<POJOWithHashCode> input = env.fromData(new POJOWithHashCode(new int[] {1, 2}));
@@ -1592,15 +1609,13 @@ public class DataStreamTest extends TestLogger {
                         PrimitiveArrayTypeInfo.INT_PRIMITIVE_ARRAY_TYPE_INFO);
 
         // adjust the rule
-        expectedException.expect(InvalidProgramException.class);
-        expectedException.expectMessage(
-                new StringStartsWith("Type " + expectedTypeInfo + " cannot be used as key."));
-
-        input.keyBy("id");
+        assertThatThrownBy(() -> input.keyBy("id"))
+                .isInstanceOf(InvalidProgramException.class)
+                .hasMessageStartingWith("Type " + expectedTypeInfo + " cannot be used as key.");
     }
 
     @Test
-    public void testPOJOWithNestedArrayAndHashCodeWorkAround() {
+    void testPOJOWithNestedArrayAndHashCodeWorkAround() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         DataStream<POJOWithHashCode> input = env.fromData(new POJOWithHashCode(new int[] {1, 2}));
@@ -1616,14 +1631,14 @@ public class DataStreamTest extends TestLogger {
                 .addSink(
                         new SinkFunction<POJOWithHashCode>() {
                             @Override
-                            public void invoke(POJOWithHashCode value) throws Exception {
-                                Assert.assertEquals(value.getId(), new int[] {1, 2});
+                            public void invoke(POJOWithHashCode value) {
+                                assertThat(value.getId()).containsExactly(1, 2);
                             }
                         });
     }
 
     @Test
-    public void testPOJOnoHashCodeKeyRejection() {
+    void testPOJOnoHashCodeKeyRejection() {
 
         KeySelector<POJOWithoutHashCode, POJOWithoutHashCode> keySelector =
                 new KeySelector<POJOWithoutHashCode, POJOWithoutHashCode>() {
@@ -1639,15 +1654,14 @@ public class DataStreamTest extends TestLogger {
                 env.fromData(new POJOWithoutHashCode(new int[] {1, 2}));
 
         // adjust the rule
-        expectedException.expect(InvalidProgramException.class);
-
-        input.keyBy(keySelector);
+        assertThatThrownBy(() -> input.keyBy(keySelector))
+                .isInstanceOf(InvalidProgramException.class);
     }
 
     ////////////////			Composite Key Tests : Tuples			////////////////
 
     @Test
-    public void testTupleNestedArrayKeyRejection() {
+    void testTupleNestedArrayKeyRejection() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         DataStream<Tuple2<Integer[], String>> input =
@@ -1658,22 +1672,25 @@ public class DataStreamTest extends TestLogger {
                         BasicArrayTypeInfo.INT_ARRAY_TYPE_INFO, BasicTypeInfo.STRING_TYPE_INFO);
 
         // adjust the rule
-        expectedException.expect(InvalidProgramException.class);
-        expectedException.expectMessage(
-                new StringStartsWith("Type " + expectedTypeInfo + " cannot be used as key."));
-
-        input.keyBy(
-                new KeySelector<Tuple2<Integer[], String>, Tuple2<Integer[], String>>() {
-                    @Override
-                    public Tuple2<Integer[], String> getKey(Tuple2<Integer[], String> value)
-                            throws Exception {
-                        return value;
-                    }
-                });
+        assertThatThrownBy(
+                        () ->
+                                input.keyBy(
+                                        new KeySelector<
+                                                Tuple2<Integer[], String>,
+                                                Tuple2<Integer[], String>>() {
+                                            @Override
+                                            public Tuple2<Integer[], String> getKey(
+                                                    Tuple2<Integer[], String> value)
+                                                    throws Exception {
+                                                return value;
+                                            }
+                                        }))
+                .isInstanceOf(InvalidProgramException.class)
+                .hasMessageStartingWith("Type " + expectedTypeInfo + " cannot be used as key.");
     }
 
     @Test
-    public void testPrimitiveKeyAcceptance() throws Exception {
+    void testPrimitiveKeyAcceptance() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
         env.setParallelism(1);
         env.setMaxParallelism(1);
@@ -1693,7 +1710,7 @@ public class DataStreamTest extends TestLogger {
                 new SinkFunction<Integer>() {
                     @Override
                     public void invoke(Integer value) throws Exception {
-                        Assert.assertEquals(10000L, (long) value);
+                        assertThat(value).isEqualTo(10000);
                     }
                 });
     }
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/RestartStrategyTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/RestartStrategyTest.java
index e27065ed04b..f2909276b36 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/RestartStrategyTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/RestartStrategyTest.java
@@ -22,20 +22,20 @@ import org.apache.flink.api.common.restartstrategy.RestartStrategies;
 import org.apache.flink.runtime.jobgraph.JobGraph;
 import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
 import org.apache.flink.streaming.api.graph.StreamGraph;
-import org.apache.flink.util.TestLogger;
 
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
 
 /** Tests for {@link RestartStrategies}. */
-public class RestartStrategyTest extends TestLogger {
+class RestartStrategyTest {
 
     /**
      * Tests that in a streaming use case where checkpointing is enabled, there is no default
      * strategy set on the client side.
      */
     @Test
-    public void testFallbackStrategyOnClientSideWhenCheckpointingEnabled() throws Exception {
+    void testFallbackStrategyOnClientSideWhenCheckpointingEnabled() throws Exception {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
         env.enableCheckpointing(500);
 
@@ -49,9 +49,9 @@ public class RestartStrategyTest extends TestLogger {
                         .deserializeValue(getClass().getClassLoader())
                         .getRestartStrategy();
 
-        Assert.assertNotNull(restartStrategy);
-        Assert.assertTrue(
-                restartStrategy instanceof RestartStrategies.FallbackRestartStrategyConfiguration);
+        assertThat(restartStrategy)
+                .isNotNull()
+                .isInstanceOf(RestartStrategies.FallbackRestartStrategyConfiguration.class);
     }
 
     /**
@@ -59,8 +59,7 @@ public class RestartStrategyTest extends TestLogger {
      * execution retries is set to 0, restarting is deactivated.
      */
     @Test
-    public void testNoRestartingWhenCheckpointingAndExplicitExecutionRetriesZero()
-            throws Exception {
+    void testNoRestartingWhenCheckpointingAndExplicitExecutionRetriesZero() throws Exception {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
         env.enableCheckpointing(500);
         env.setNumberOfExecutionRetries(0);
@@ -75,9 +74,9 @@ public class RestartStrategyTest extends TestLogger {
                         .deserializeValue(getClass().getClassLoader())
                         .getRestartStrategy();
 
-        Assert.assertNotNull(restartStrategy);
-        Assert.assertTrue(
-                restartStrategy instanceof RestartStrategies.NoRestartStrategyConfiguration);
+        assertThat(restartStrategy)
+                .isNotNull()
+                .isInstanceOf(RestartStrategies.NoRestartStrategyConfiguration.class);
     }
 
     /**
@@ -85,8 +84,7 @@ public class RestartStrategyTest extends TestLogger {
      * execution retries is set to 42 and the delay to 1337, fixed delay restarting is used.
      */
     @Test
-    public void testFixedRestartingWhenCheckpointingAndExplicitExecutionRetriesNonZero()
-            throws Exception {
+    void testFixedRestartingWhenCheckpointingAndExplicitExecutionRetriesNonZero() throws Exception {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
         env.enableCheckpointing(500);
         env.setNumberOfExecutionRetries(42);
@@ -102,18 +100,23 @@ public class RestartStrategyTest extends TestLogger {
                         .deserializeValue(getClass().getClassLoader())
                         .getRestartStrategy();
 
-        Assert.assertNotNull(restartStrategy);
-        Assert.assertTrue(
-                restartStrategy
-                        instanceof RestartStrategies.FixedDelayRestartStrategyConfiguration);
-        Assert.assertEquals(
-                42,
-                ((RestartStrategies.FixedDelayRestartStrategyConfiguration) restartStrategy)
-                        .getRestartAttempts());
-        Assert.assertEquals(
-                1337,
-                ((RestartStrategies.FixedDelayRestartStrategyConfiguration) restartStrategy)
-                        .getDurationBetweenAttempts()
-                        .toMillis());
+        assertThat(restartStrategy)
+                .isNotNull()
+                .isInstanceOfSatisfying(
+                        RestartStrategies.FixedDelayRestartStrategyConfiguration.class,
+                        strategy ->
+                                assertThat(strategy)
+                                        .satisfies(
+                                                fixedDelayRestartStrategy -> {
+                                                    assertThat(
+                                                                    fixedDelayRestartStrategy
+                                                                            .getRestartAttempts())
+                                                            .isEqualTo(42);
+                                                    assertThat(
+                                                                    fixedDelayRestartStrategy
+                                                                            .getDurationBetweenAttempts()
+                                                                            .toMillis())
+                                                            .isEqualTo(1337);
+                                                }));
     }
 }
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/SourceFunctionTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/SourceFunctionTest.java
index 75457307676..61e62dad342 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/SourceFunctionTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/SourceFunctionTest.java
@@ -23,35 +23,35 @@ import org.apache.flink.streaming.api.functions.source.FromElementsFunction;
 import org.apache.flink.streaming.api.functions.source.SourceFunction;
 import org.apache.flink.streaming.util.SourceFunctionUtil;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import java.util.Arrays;
 import java.util.List;
 
-import static org.junit.Assert.assertEquals;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /** Tests for {@link SourceFunction}. */
-public class SourceFunctionTest {
+class SourceFunctionTest {
 
     @Test
-    public void fromElementsTest() throws Exception {
+    void fromElementsTest() throws Exception {
         List<Integer> expectedList = Arrays.asList(1, 2, 3);
         List<Integer> actualList =
                 SourceFunctionUtil.runSourceFunction(
                         CommonTestUtils.createCopySerializable(
                                 new FromElementsFunction<Integer>(
                                         IntSerializer.INSTANCE, 1, 2, 3)));
-        assertEquals(expectedList, actualList);
+        assertThat(actualList).isEqualTo(expectedList);
     }
 
     @Test
-    public void fromCollectionTest() throws Exception {
+    void fromCollectionTest() throws Exception {
         List<Integer> expectedList = Arrays.asList(1, 2, 3);
         List<Integer> actualList =
                 SourceFunctionUtil.runSourceFunction(
                         CommonTestUtils.createCopySerializable(
                                 new FromElementsFunction<Integer>(
                                         IntSerializer.INSTANCE, Arrays.asList(1, 2, 3))));
-        assertEquals(expectedList, actualList);
+        assertThat(actualList).isEqualTo(expectedList);
     }
 }
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/TypeFillTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/TypeFillTest.java
index a6d1cb1ced0..fbabad51e01 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/TypeFillTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/TypeFillTest.java
@@ -18,6 +18,7 @@
 package org.apache.flink.streaming.api;
 
 import org.apache.flink.api.common.functions.FlatMapFunction;
+import org.apache.flink.api.common.functions.InvalidTypesException;
 import org.apache.flink.api.common.functions.MapFunction;
 import org.apache.flink.api.common.typeinfo.BasicTypeInfo;
 import org.apache.flink.api.common.typeinfo.TypeHint;
@@ -33,88 +34,80 @@ import org.apache.flink.streaming.api.functions.source.SourceFunction;
 import org.apache.flink.streaming.api.windowing.time.Time;
 import org.apache.flink.util.Collector;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 /**
  * Tests for handling missing type information either by calling {@code returns()} or having an
  * explicit type information parameter.
  */
 @SuppressWarnings("serial")
-public class TypeFillTest {
+class TypeFillTest {
 
     @Test
-    public void test() {
+    void test() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
-        try {
-            env.addSource(new TestSource<Integer>()).print();
-            fail();
-        } catch (Exception ignored) {
-        }
+        assertThatThrownBy(() -> env.addSource(new TestSource<Integer>()).print())
+                .isInstanceOf(InvalidTypesException.class);
 
         DataStream<Long> source = env.fromSequence(1, 10);
 
-        try {
-            source.map(new TestMap<Long, Long>()).print();
-            fail();
-        } catch (Exception ignored) {
-        }
-
-        try {
-            source.flatMap(new TestFlatMap<Long, Long>()).print();
-            fail();
-        } catch (Exception ignored) {
-        }
-
-        try {
-            source.connect(source).map(new TestCoMap<Long, Long, Integer>()).print();
-            fail();
-        } catch (Exception ignored) {
-        }
-
-        try {
-            source.connect(source).flatMap(new TestCoFlatMap<Long, Long, Integer>()).print();
-            fail();
-        } catch (Exception ignored) {
-        }
-
-        try {
-            source.keyBy(new TestKeySelector<Long, String>()).print();
-            fail();
-        } catch (Exception ignored) {
-        }
-
-        try {
-            source.connect(source)
-                    .keyBy(new TestKeySelector<Long, String>(), new TestKeySelector<>());
-            fail();
-        } catch (Exception ignored) {
-        }
-
-        try {
-            source.coGroup(source).where(new TestKeySelector<>()).equalTo(new TestKeySelector<>());
-            fail();
-        } catch (Exception ignored) {
-        }
-
-        try {
-            source.join(source).where(new TestKeySelector<>()).equalTo(new TestKeySelector<>());
-            fail();
-        } catch (Exception ignored) {
-        }
-
-        try {
-            source.keyBy((in) -> in)
-                    .intervalJoin(source.keyBy((in) -> in))
-                    .between(Time.milliseconds(10L), Time.milliseconds(10L))
-                    .process(new TestProcessJoinFunction<>())
-                    .print();
-            fail();
-        } catch (Exception ignored) {
-        }
+        assertThatThrownBy(() -> source.map(new TestMap<Long, Long>()).print())
+                .isInstanceOf(InvalidTypesException.class);
+
+        assertThatThrownBy(() -> source.flatMap(new TestFlatMap<Long, Long>()).print())
+                .isInstanceOf(InvalidTypesException.class);
+
+        assertThatThrownBy(
+                        () ->
+                                source.connect(source)
+                                        .map(new TestCoMap<Long, Long, Integer>())
+                                        .print())
+                .isInstanceOf(InvalidTypesException.class);
+
+        assertThatThrownBy(
+                        () ->
+                                source.connect(source)
+                                        .flatMap(new TestCoFlatMap<Long, Long, Integer>())
+                                        .print())
+                .isInstanceOf(InvalidTypesException.class);
+
+        assertThatThrownBy(() -> source.keyBy(new TestKeySelector<Long, String>()).print())
+                .isInstanceOf(InvalidTypesException.class);
+
+        assertThatThrownBy(
+                        () ->
+                                source.connect(source)
+                                        .keyBy(
+                                                new TestKeySelector<Long, String>(),
+                                                new TestKeySelector<>()))
+                .isInstanceOf(InvalidTypesException.class);
+
+        assertThatThrownBy(
+                        () ->
+                                source.coGroup(source)
+                                        .where(new TestKeySelector<>())
+                                        .equalTo(new TestKeySelector<>()))
+                .isInstanceOf(InvalidTypesException.class);
+
+        assertThatThrownBy(
+                        () ->
+                                source.join(source)
+                                        .where(new TestKeySelector<>())
+                                        .equalTo(new TestKeySelector<>()))
+                .isInstanceOf(InvalidTypesException.class);
+
+        assertThatThrownBy(
+                        () ->
+                                source.keyBy((in) -> in)
+                                        .intervalJoin(source.keyBy((in) -> in))
+                                        .between(Time.milliseconds(10L), Time.milliseconds(10L))
+                                        .process(new TestProcessJoinFunction<>())
+                                        .print())
+                .isInstanceOf(InvalidTypesException.class);
 
         env.addSource(new TestSource<Integer>()).returns(Integer.class);
         source.map(new TestMap<Long, Long>()).returns(Long.class).print();
@@ -145,9 +138,8 @@ public class TypeFillTest {
                 .between(Time.milliseconds(10L), Time.milliseconds(10L))
                 .process(new TestProcessJoinFunction<>(), Types.STRING);
 
-        assertEquals(
-                BasicTypeInfo.LONG_TYPE_INFO,
-                source.map(new TestMap<Long, Long>()).returns(Long.class).getType());
+        assertThat(source.map(new TestMap<Long, Long>()).returns(Long.class).getType())
+                .isEqualTo(BasicTypeInfo.LONG_TYPE_INFO);
 
         SingleOutputStreamOperator<String> map =
                 source.map(
@@ -160,11 +152,8 @@ public class TypeFillTest {
                         });
 
         map.print();
-        try {
-            map.returns(String.class);
-            fail();
-        } catch (Exception ignored) {
-        }
+        assertThatThrownBy(() -> map.returns(String.class))
+                .isInstanceOf(IllegalStateException.class);
     }
 
     private static class TestSource<T> implements SourceFunction<T> {
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/checkpoint/ListCheckpointedTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/checkpoint/ListCheckpointedTest.java
index 0a9e110d2a3..7371e2df78e 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/checkpoint/ListCheckpointedTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/checkpoint/ListCheckpointedTest.java
@@ -23,31 +23,29 @@ import org.apache.flink.runtime.checkpoint.OperatorSubtaskState;
 import org.apache.flink.streaming.api.operators.StreamMap;
 import org.apache.flink.streaming.util.AbstractStreamOperatorTestHarness;
 
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /** Tests for {@link ListCheckpointed}. */
-public class ListCheckpointedTest {
+class ListCheckpointedTest {
 
     @Test
-    public void testUDFReturningNull() throws Exception {
+    void testUDFReturningNull() throws Exception {
         testUDF(new TestUserFunction(null));
     }
 
     @Test
-    public void testUDFReturningEmpty() throws Exception {
+    void testUDFReturningEmpty() throws Exception {
         testUDF(new TestUserFunction(Collections.<Integer>emptyList()));
     }
 
     @Test
-    public void testUDFReturningData() throws Exception {
+    void testUDFReturningData() throws Exception {
         testUDF(new TestUserFunction(Arrays.asList(1, 2, 3)));
     }
 
@@ -57,13 +55,13 @@ public class ListCheckpointedTest {
                 createTestHarness(userFunction)) {
             testHarness.open();
             snapshot = testHarness.snapshot(0L, 0L);
-            assertFalse(userFunction.isRestored());
+            assertThat(userFunction.isRestored()).isFalse();
         }
         try (AbstractStreamOperatorTestHarness<Integer> testHarness =
                 createTestHarness(userFunction)) {
             testHarness.initializeState(snapshot);
             testHarness.open();
-            assertTrue(userFunction.isRestored());
+            assertThat(userFunction.isRestored()).isTrue();
         }
     }
 
@@ -98,9 +96,9 @@ public class ListCheckpointedTest {
         @Override
         public void restoreState(List<Integer> state) throws Exception {
             if (null != expected) {
-                Assert.assertEquals(expected, state);
+                assertThat(state).isEqualTo(expected);
             } else {
-                assertTrue(state.isEmpty());
+                assertThat(state).isEmpty();
             }
             restored = true;
         }
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/datastream/CoGroupedStreamsTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/datastream/CoGroupedStreamsTest.java
index 5a8446d264a..3e964bf7565 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/datastream/CoGroupedStreamsTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/datastream/CoGroupedStreamsTest.java
@@ -24,22 +24,23 @@ import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
 import org.apache.flink.streaming.api.windowing.assigners.TumblingEventTimeWindows;
 import org.apache.flink.streaming.api.windowing.windows.TimeWindow;
 
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 import java.time.Duration;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 /** Unit test for {@link CoGroupedStreams}. */
-public class CoGroupedStreamsTest {
+class CoGroupedStreamsTest {
     private DataStream<String> dataStream1;
     private DataStream<String> dataStream2;
     private KeySelector<String, String> keySelector;
     private TumblingEventTimeWindows tsAssigner;
     private CoGroupFunction<String, String, String> coGroupFunction;
 
-    @Before
-    public void setUp() {
+    @BeforeEach
+    void setUp() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
         dataStream1 = env.fromData("a1", "a2", "a3");
         dataStream2 = env.fromData("a1", "a2");
@@ -50,7 +51,7 @@ public class CoGroupedStreamsTest {
     }
 
     @Test
-    public void testDelegateToCoGrouped() {
+    void testDelegateToCoGrouped() {
         Duration lateness = Duration.ofMillis(42L);
 
         CoGroupedStreams.WithWindow<String, String, String, TimeWindow> withLateness =
@@ -63,12 +64,12 @@ public class CoGroupedStreamsTest {
 
         withLateness.apply(coGroupFunction, BasicTypeInfo.STRING_TYPE_INFO);
 
-        Assert.assertEquals(
-                lateness.toMillis(), withLateness.getWindowedStream().getAllowedLateness());
+        assertThat(withLateness.getWindowedStream().getAllowedLateness())
+                .isEqualTo(lateness.toMillis());
     }
 
     @Test
-    public void testSetAllowedLateness() {
+    void testSetAllowedLateness() {
         Duration lateness = Duration.ofMillis(42L);
 
         CoGroupedStreams.WithWindow<String, String, String, TimeWindow> withLateness =
@@ -79,6 +80,6 @@ public class CoGroupedStreamsTest {
                         .window(tsAssigner)
                         .allowedLateness(lateness);
 
-        Assert.assertEquals(lateness, withLateness.getAllowedLatenessDuration().orElse(null));
+        assertThat(withLateness.getAllowedLatenessDuration()).hasValue(lateness);
     }
 }
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/datastream/DataStreamSinkDeprecatedTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/datastream/DataStreamSinkDeprecatedTest.java
index 45140ff567c..a873f3a0b47 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/datastream/DataStreamSinkDeprecatedTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/datastream/DataStreamSinkDeprecatedTest.java
@@ -22,9 +22,10 @@ import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
 import org.apache.flink.streaming.api.transformations.SinkTransformation;
 import org.apache.flink.streaming.runtime.operators.sink.deprecated.TestSinkV2;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertTrue;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 /**
  * Unit test for {@link DataStreamSink}.
@@ -33,21 +34,27 @@ import static org.junit.Assert.assertTrue;
  * org.apache.flink.api.connector.sink2.TwoPhaseCommittingSink}.
  */
 @Deprecated
-public class DataStreamSinkDeprecatedTest {
+class DataStreamSinkDeprecatedTest {
 
     @Test
-    public void testGettingTransformationWithNewSinkAPI() {
+    void testGettingTransformationWithNewSinkAPI() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
         final Transformation<?> transformation =
                 env.fromData(1, 2)
                         .sinkTo(TestSinkV2.<Integer>newBuilder().build())
                         .getTransformation();
-        assertTrue(transformation instanceof SinkTransformation);
+        assertThat(transformation).isInstanceOf(SinkTransformation.class);
     }
 
-    @Test(expected = UnsupportedOperationException.class)
-    public void throwExceptionWhenSetUidWithNewSinkAPI() {
+    @Test
+    void throwExceptionWhenSetUidWithNewSinkAPI() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
-        env.fromData(1, 2).sinkTo(TestSinkV2.<Integer>newBuilder().build()).setUidHash("Test");
+
+        assertThatThrownBy(
+                        () ->
+                                env.fromData(1, 2)
+                                        .sinkTo(TestSinkV2.<Integer>newBuilder().build())
+                                        .setUidHash("Test"))
+                .isInstanceOf(UnsupportedOperationException.class);
     }
 }
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/datastream/DataStreamSinkTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/datastream/DataStreamSinkTest.java
index d0d96f1b4d0..b4017222e5a 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/datastream/DataStreamSinkTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/datastream/DataStreamSinkTest.java
@@ -22,26 +22,33 @@ import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
 import org.apache.flink.streaming.api.transformations.SinkTransformation;
 import org.apache.flink.streaming.runtime.operators.sink.TestSinkV2;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertTrue;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 /** Unit test for {@link DataStreamSink}. */
-public class DataStreamSinkTest {
+class DataStreamSinkTest {
 
     @Test
-    public void testGettingTransformationWithNewSinkAPI() {
+    void testGettingTransformationWithNewSinkAPI() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
         final Transformation<?> transformation =
                 env.fromData(1, 2)
                         .sinkTo(TestSinkV2.<Integer>newBuilder().build())
                         .getTransformation();
-        assertTrue(transformation instanceof SinkTransformation);
+        assertThat(transformation).isInstanceOf(SinkTransformation.class);
     }
 
-    @Test(expected = UnsupportedOperationException.class)
-    public void throwExceptionWhenSetUidWithNewSinkAPI() {
+    @Test
+    void throwExceptionWhenSetUidWithNewSinkAPI() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
-        env.fromData(1, 2).sinkTo(TestSinkV2.<Integer>newBuilder().build()).setUidHash("Test");
+
+        assertThatThrownBy(
+                        () ->
+                                env.fromData(1, 2)
+                                        .sinkTo(TestSinkV2.<Integer>newBuilder().build())
+                                        .setUidHash("Test"))
+                .isInstanceOf(UnsupportedOperationException.class);
     }
 }
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/datastream/DataStreamSourceTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/datastream/DataStreamSourceTest.java
index 39781aace60..ec6f423c7ed 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/datastream/DataStreamSourceTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/datastream/DataStreamSourceTest.java
@@ -22,26 +22,24 @@ import org.apache.flink.api.connector.source.Boundedness;
 import org.apache.flink.api.connector.source.mocks.MockSource;
 import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertEquals;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /** Unit test for {@link DataStreamSource}. */
-public class DataStreamSourceTest {
+class DataStreamSourceTest {
 
     /** Test constructor for new Sources (FLIP-27). */
     @Test
-    public void testConstructor() {
+    void testConstructor() {
         int expectParallelism = 100;
-        boolean expectIsParallel = true;
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
         MockSource mockSource = new MockSource(Boundedness.BOUNDED, 10);
         DataStreamSource<Integer> stream =
                 env.fromSource(mockSource, WatermarkStrategy.noWatermarks(), "TestingSource");
         stream.setParallelism(expectParallelism);
 
-        assertEquals(expectIsParallel, stream.isParallel());
-
-        assertEquals(expectParallelism, stream.getParallelism());
+        assertThat(stream.isParallel()).isTrue();
+        assertThat(stream.getParallelism()).isEqualTo(expectParallelism);
     }
 }
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/datastream/JoinedStreamsTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/datastream/JoinedStreamsTest.java
index 4a3898a265c..9dfb8a84634 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/datastream/JoinedStreamsTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/datastream/JoinedStreamsTest.java
@@ -24,22 +24,23 @@ import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
 import org.apache.flink.streaming.api.windowing.assigners.TumblingEventTimeWindows;
 import org.apache.flink.streaming.api.windowing.windows.TimeWindow;
 
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 import java.time.Duration;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 /** Unit test for {@link JoinedStreams}. */
-public class JoinedStreamsTest {
+class JoinedStreamsTest {
     private DataStream<String> dataStream1;
     private DataStream<String> dataStream2;
     private KeySelector<String, String> keySelector;
     private TumblingEventTimeWindows tsAssigner;
     private JoinFunction<String, String, String> joinFunction;
 
-    @Before
-    public void setUp() {
+    @BeforeEach
+    void setUp() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
         dataStream1 = env.fromData("a1", "a2", "a3");
         dataStream2 = env.fromData("a1", "a2");
@@ -49,7 +50,7 @@ public class JoinedStreamsTest {
     }
 
     @Test
-    public void testDelegateToCoGrouped() {
+    void testDelegateToCoGrouped() {
         Duration lateness = Duration.ofMillis(42L);
 
         JoinedStreams.WithWindow<String, String, String, TimeWindow> withLateness =
@@ -62,16 +63,12 @@ public class JoinedStreamsTest {
 
         withLateness.apply(joinFunction, BasicTypeInfo.STRING_TYPE_INFO);
 
-        Assert.assertEquals(
-                lateness,
-                withLateness
-                        .getCoGroupedWindowedStream()
-                        .getAllowedLatenessDuration()
-                        .orElse(null));
+        assertThat(withLateness.getCoGroupedWindowedStream().getAllowedLatenessDuration())
+                .hasValue(lateness);
     }
 
     @Test
-    public void testSetAllowedLateness() {
+    void testSetAllowedLateness() {
         Duration lateness = Duration.ofMillis(42L);
 
         JoinedStreams.WithWindow<String, String, String, TimeWindow> withLateness =
@@ -82,6 +79,6 @@ public class JoinedStreamsTest {
                         .window(tsAssigner)
                         .allowedLateness(lateness);
 
-        Assert.assertEquals(lateness, withLateness.getAllowedLatenessDuration().orElse(null));
+        assertThat(withLateness.getAllowedLatenessDuration()).hasValue(lateness);
     }
 }
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironmentConfigurationTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironmentConfigurationTest.java
index ef54374740b..dc7bce84f15 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironmentConfigurationTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironmentConfigurationTest.java
@@ -23,18 +23,19 @@ import org.apache.flink.api.common.ExecutionConfigTest;
 import org.apache.flink.configuration.Configuration;
 import org.apache.flink.configuration.ReadableConfig;
 import org.apache.flink.streaming.api.TimeCharacteristic;
+import org.apache.flink.testutils.junit.extensions.parameterized.Parameter;
+import org.apache.flink.testutils.junit.extensions.parameterized.ParameterizedTestExtension;
+import org.apache.flink.testutils.junit.extensions.parameterized.Parameters;
 
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.TestTemplate;
+import org.junit.jupiter.api.extension.ExtendWith;
 
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.function.BiConsumer;
 import java.util.function.Function;
 
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.junit.Assert.assertThat;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /**
  * Tests for configuring {@link StreamExecutionEnvironment} via {@link
@@ -42,11 +43,11 @@ import static org.junit.Assert.assertThat;
  *
  * @see StreamExecutionEnvironmentComplexConfigurationTest
  */
-@RunWith(Parameterized.class)
-public class StreamExecutionEnvironmentConfigurationTest {
+@ExtendWith(ParameterizedTestExtension.class)
+class StreamExecutionEnvironmentConfigurationTest {
 
-    @Parameterized.Parameters(name = "{0}")
-    public static Collection<TestSpec> specs() {
+    @Parameters(name = "{0}")
+    private static Collection<TestSpec> specs() {
         return Arrays.asList(
                 TestSpec.testValue(TimeCharacteristic.IngestionTime)
                         .whenSetFromFile("pipeline.time-characteristic", "IngestionTime")
@@ -83,10 +84,10 @@ public class StreamExecutionEnvironmentConfigurationTest {
                         .nonDefaultValue(100L));
     }
 
-    @Parameterized.Parameter public TestSpec spec;
+    @Parameter private TestSpec spec;
 
-    @Test
-    public void testLoadingFromConfiguration() {
+    @TestTemplate
+    void testLoadingFromConfiguration() {
         StreamExecutionEnvironment configFromSetters =
                 StreamExecutionEnvironment.getExecutionEnvironment();
         StreamExecutionEnvironment configFromFile =
@@ -100,8 +101,8 @@ public class StreamExecutionEnvironmentConfigurationTest {
         spec.assertEqual(configFromFile, configFromSetters);
     }
 
-    @Test
-    public void testNotOverridingIfNotSet() {
+    @TestTemplate
+    void testNotOverridingIfNotSet() {
         StreamExecutionEnvironment environment =
                 StreamExecutionEnvironment.getExecutionEnvironment();
 
@@ -160,11 +161,11 @@ public class StreamExecutionEnvironmentConfigurationTest {
         public void assertEqual(
                 StreamExecutionEnvironment configFromFile,
                 StreamExecutionEnvironment configFromSetters) {
-            assertThat(getter.apply(configFromFile), equalTo(getter.apply(configFromSetters)));
+            assertThat(getter.apply(configFromFile)).isEqualTo(getter.apply(configFromSetters));
         }
 
         public void assertEqualNonDefault(StreamExecutionEnvironment configFromFile) {
-            assertThat(getter.apply(configFromFile), equalTo(nonDefaultValue));
+            assertThat(getter.apply(configFromFile)).isEqualTo(nonDefaultValue);
         }
 
         @Override
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/AscendingTimestampExtractorTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/AscendingTimestampExtractorTest.java
index 0a5e7b15788..e97020165e9 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/AscendingTimestampExtractorTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/AscendingTimestampExtractorTest.java
@@ -20,30 +20,28 @@ package org.apache.flink.streaming.api.functions;
 
 import org.apache.flink.streaming.api.functions.timestamps.AscendingTimestampExtractor;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 /** Tests for {@link AscendingTimestampExtractor}. */
-public class AscendingTimestampExtractorTest {
+class AscendingTimestampExtractorTest {
 
     @Test
-    public void testWithFailingHandler() {
+    void testWithFailingHandler() {
         AscendingTimestampExtractor<Long> extractor =
                 new LongExtractor()
                         .withViolationHandler(new AscendingTimestampExtractor.FailingHandler());
 
         runValidTests(extractor);
-        try {
-            runInvalidTest(extractor);
-            fail("should fail with an exception");
-        } catch (Exception ignored) {
-        }
+        assertThatThrownBy(() -> runInvalidTest(extractor))
+                .isInstanceOf(RuntimeException.class)
+                .hasMessageContaining("Ascending timestamps condition violated.");
     }
 
     @Test
-    public void testWithIgnoringHandler() {
+    void testWithIgnoringHandler() {
         AscendingTimestampExtractor<Long> extractor =
                 new LongExtractor()
                         .withViolationHandler(new AscendingTimestampExtractor.IgnoringHandler());
@@ -53,7 +51,7 @@ public class AscendingTimestampExtractorTest {
     }
 
     @Test
-    public void testWithLoggingHandler() {
+    void testWithLoggingHandler() {
         AscendingTimestampExtractor<Long> extractor =
                 new LongExtractor()
                         .withViolationHandler(new AscendingTimestampExtractor.LoggingHandler());
@@ -63,7 +61,7 @@ public class AscendingTimestampExtractorTest {
     }
 
     @Test
-    public void testWithDefaultHandler() {
+    void testWithDefaultHandler() {
         AscendingTimestampExtractor<Long> extractor = new LongExtractor();
 
         runValidTests(extractor);
@@ -71,36 +69,37 @@ public class AscendingTimestampExtractorTest {
     }
 
     @Test
-    public void testInitialAndFinalWatermark() {
+    void testInitialAndFinalWatermark() {
         AscendingTimestampExtractor<Long> extractor = new LongExtractor();
-        assertEquals(Long.MIN_VALUE, extractor.getCurrentWatermark().getTimestamp());
+        assertThat(extractor.getCurrentWatermark().getTimestamp()).isEqualTo(Long.MIN_VALUE);
 
         extractor.extractTimestamp(Long.MIN_VALUE, -1L);
 
         extractor.extractTimestamp(Long.MAX_VALUE, -1L);
-        assertEquals(Long.MAX_VALUE - 1, extractor.getCurrentWatermark().getTimestamp());
+        assertThat(extractor.getCurrentWatermark().getTimestamp()).isEqualTo(Long.MAX_VALUE - 1);
     }
 
     // ------------------------------------------------------------------------
 
     private void runValidTests(AscendingTimestampExtractor<Long> extractor) {
-        assertEquals(13L, extractor.extractTimestamp(13L, -1L));
-        assertEquals(13L, extractor.extractTimestamp(13L, 0L));
-        assertEquals(14L, extractor.extractTimestamp(14L, 0L));
-        assertEquals(20L, extractor.extractTimestamp(20L, 0L));
-        assertEquals(20L, extractor.extractTimestamp(20L, 0L));
-        assertEquals(20L, extractor.extractTimestamp(20L, 0L));
-        assertEquals(500L, extractor.extractTimestamp(500L, 0L));
-
-        assertEquals(Long.MAX_VALUE - 1, extractor.extractTimestamp(Long.MAX_VALUE - 1, 99999L));
+        assertThat(extractor.extractTimestamp(13L, -1L)).isEqualTo(13L);
+        assertThat(extractor.extractTimestamp(13L, 0L)).isEqualTo(13L);
+        assertThat(extractor.extractTimestamp(14L, 0L)).isEqualTo(14L);
+        assertThat(extractor.extractTimestamp(20L, 0L)).isEqualTo(20L);
+        assertThat(extractor.extractTimestamp(20L, 0L)).isEqualTo(20L);
+        assertThat(extractor.extractTimestamp(20L, 0L)).isEqualTo(20L);
+        assertThat(extractor.extractTimestamp(500L, 0L)).isEqualTo(500L);
+
+        assertThat(extractor.extractTimestamp(Long.MAX_VALUE - 1, 99999L))
+                .isEqualTo(Long.MAX_VALUE - 1);
     }
 
     private void runInvalidTest(AscendingTimestampExtractor<Long> extractor) {
-        assertEquals(1000L, extractor.extractTimestamp(1000L, 100));
-        assertEquals(1000L, extractor.extractTimestamp(1000L, 100));
+        assertThat(extractor.extractTimestamp(1000L, 100)).isEqualTo(1000L);
+        assertThat(extractor.extractTimestamp(1000L, 100)).isEqualTo(1000L);
 
         // violation
-        assertEquals(999L, extractor.extractTimestamp(999L, 100));
+        assertThat(extractor.extractTimestamp(999L, 100)).isEqualTo(999L);
     }
 
     // ------------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/BoundedOutOfOrdernessTimestampExtractorTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/BoundedOutOfOrdernessTimestampExtractorTest.java
index f08b7d2054b..fad7fbb88dc 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/BoundedOutOfOrdernessTimestampExtractorTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/BoundedOutOfOrdernessTimestampExtractorTest.java
@@ -22,29 +22,30 @@ import org.apache.flink.streaming.api.functions.timestamps.BoundedOutOfOrderness
 import org.apache.flink.streaming.api.watermark.Watermark;
 import org.apache.flink.streaming.api.windowing.time.Time;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertEquals;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /** Tests for {@link BoundedOutOfOrdernessTimestampExtractor}. */
-public class BoundedOutOfOrdernessTimestampExtractorTest {
+class BoundedOutOfOrdernessTimestampExtractorTest {
 
     @Test
-    public void testInitializationAndRuntime() {
+    void testInitializationAndRuntime() {
         Time maxAllowedLateness = Time.milliseconds(10L);
         BoundedOutOfOrdernessTimestampExtractor<Long> extractor =
                 new LongExtractor(maxAllowedLateness);
 
-        assertEquals(maxAllowedLateness.toMilliseconds(), extractor.getMaxOutOfOrdernessInMillis());
+        assertThat(extractor.getMaxOutOfOrdernessInMillis())
+                .isEqualTo(maxAllowedLateness.toMilliseconds());
 
         runValidTests(extractor);
     }
 
     @Test
-    public void testInitialFinalAndWatermarkUnderflow() {
+    void testInitialFinalAndWatermarkUnderflow() {
         BoundedOutOfOrdernessTimestampExtractor<Long> extractor =
                 new LongExtractor(Time.milliseconds(10L));
-        assertEquals(Long.MIN_VALUE, extractor.getCurrentWatermark().getTimestamp());
+        assertThat(extractor.getCurrentWatermark().getTimestamp()).isEqualTo(Long.MIN_VALUE);
 
         extractor.extractTimestamp(Long.MIN_VALUE, -1L);
 
@@ -55,32 +56,33 @@ public class BoundedOutOfOrdernessTimestampExtractorTest {
         // would lead to underflow.
 
         extractor.extractTimestamp(Long.MIN_VALUE + 2, -1);
-        assertEquals(Long.MIN_VALUE, extractor.getCurrentWatermark().getTimestamp());
+        assertThat(extractor.getCurrentWatermark().getTimestamp()).isEqualTo(Long.MIN_VALUE);
 
         extractor.extractTimestamp(Long.MAX_VALUE, -1L);
-        assertEquals(Long.MAX_VALUE - 10, extractor.getCurrentWatermark().getTimestamp());
+        assertThat(extractor.getCurrentWatermark().getTimestamp()).isEqualTo(Long.MAX_VALUE - 10);
     }
 
     // ------------------------------------------------------------------------
 
     private void runValidTests(BoundedOutOfOrdernessTimestampExtractor<Long> extractor) {
-        assertEquals(Watermark.UNINITIALIZED, extractor.getCurrentWatermark());
+        assertThat(extractor.getCurrentWatermark()).isEqualTo(Watermark.UNINITIALIZED);
 
-        assertEquals(13L, extractor.extractTimestamp(13L, 0L));
-        assertEquals(13L, extractor.extractTimestamp(13L, 0L));
-        assertEquals(14L, extractor.extractTimestamp(14L, 0L));
-        assertEquals(20L, extractor.extractTimestamp(20L, 0L));
+        assertThat(extractor.extractTimestamp(13L, 0L)).isEqualTo(13L);
+        assertThat(extractor.extractTimestamp(13L, 0L)).isEqualTo(13L);
+        assertThat(extractor.extractTimestamp(14L, 0L)).isEqualTo(14L);
+        assertThat(extractor.extractTimestamp(20L, 0L)).isEqualTo(20L);
 
-        assertEquals(new Watermark(10L), extractor.getCurrentWatermark());
+        assertThat(extractor.getCurrentWatermark()).isEqualTo(new Watermark(10L));
 
-        assertEquals(20L, extractor.extractTimestamp(20L, 0L));
-        assertEquals(20L, extractor.extractTimestamp(20L, 0L));
-        assertEquals(500L, extractor.extractTimestamp(500L, 0L));
+        assertThat(extractor.extractTimestamp(20L, 0L)).isEqualTo(20L);
+        assertThat(extractor.extractTimestamp(20L, 0L)).isEqualTo(20L);
+        assertThat(extractor.extractTimestamp(500L, 0L)).isEqualTo(500L);
 
-        assertEquals(new Watermark(490L), extractor.getCurrentWatermark());
+        assertThat(extractor.getCurrentWatermark()).isEqualTo(new Watermark(490L));
 
-        assertEquals(Long.MAX_VALUE - 1, extractor.extractTimestamp(Long.MAX_VALUE - 1, 0L));
-        assertEquals(new Watermark(Long.MAX_VALUE - 11), extractor.getCurrentWatermark());
+        assertThat(extractor.extractTimestamp(Long.MAX_VALUE - 1, 0L))
+                .isEqualTo(Long.MAX_VALUE - 1);
+        assertThat(extractor.getCurrentWatermark()).isEqualTo(new Watermark(Long.MAX_VALUE - 11));
     }
 
     // ------------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/FromElementsFunctionTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/FromElementsFunctionTest.java
index a47650d8606..7d2467fb1fa 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/FromElementsFunctionTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/FromElementsFunctionTest.java
@@ -29,42 +29,31 @@ import org.apache.flink.api.java.typeutils.TypeExtractor;
 import org.apache.flink.api.java.typeutils.ValueTypeInfo;
 import org.apache.flink.core.memory.DataInputView;
 import org.apache.flink.core.memory.DataOutputView;
+import org.apache.flink.core.testutils.CheckedThread;
 import org.apache.flink.runtime.checkpoint.OperatorSubtaskState;
 import org.apache.flink.streaming.api.functions.source.FromElementsFunction;
 import org.apache.flink.streaming.api.functions.source.SourceFunction;
 import org.apache.flink.streaming.api.operators.StreamSource;
 import org.apache.flink.streaming.util.AbstractStreamOperatorTestHarness;
 import org.apache.flink.types.Value;
-import org.apache.flink.util.ExceptionUtils;
 import org.apache.flink.util.InstantiationUtil;
 
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
 
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import static org.hamcrest.Matchers.hasSize;
-import static org.hamcrest.Matchers.instanceOf;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 /** Tests for the {@link org.apache.flink.streaming.api.functions.source.FromElementsFunction}. */
-public class FromElementsFunctionTest {
+class FromElementsFunctionTest {
 
     private static final String[] STRING_ARRAY_DATA = {"Oh", "boy", "what", "a", "show", "!"};
     private static final List<String> STRING_LIST_DATA = Arrays.asList(STRING_ARRAY_DATA);
 
-    @Rule public final ExpectedException thrown = ExpectedException.none();
-
     private static <T> List<T> runSource(FromElementsFunction<T> source) throws Exception {
         List<T> result = new ArrayList<>();
         FromElementsFunction<T> clonedSource = InstantiationUtil.clone(source);
@@ -73,54 +62,48 @@ public class FromElementsFunctionTest {
     }
 
     @Test
-    public void testStrings() {
-        try {
-            String[] data = {"Oh", "boy", "what", "a", "show", "!"};
-
-            FromElementsFunction<String> source =
-                    new FromElementsFunction<String>(
-                            BasicTypeInfo.STRING_TYPE_INFO.createSerializer(
-                                    new SerializerConfigImpl()),
-                            data);
-
-            List<String> result = new ArrayList<String>();
-            source.run(new ListSourceContext<String>(result));
-
-            assertEquals(Arrays.asList(data), result);
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail(e.getMessage());
-        }
+    void testStrings() throws Exception {
+        String[] data = {"Oh", "boy", "what", "a", "show", "!"};
+
+        FromElementsFunction<String> source =
+                new FromElementsFunction<>(
+                        BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new SerializerConfigImpl()),
+                        data);
+
+        List<String> result = new ArrayList<>();
+        source.run(new ListSourceContext<>(result));
+
+        assertThat(result).containsExactly(data);
     }
 
     @Test
-    public void testNullElement() throws Exception {
-        thrown.expect(IllegalArgumentException.class);
-        thrown.expectMessage("contains a null element");
-
-        new FromElementsFunction<>("a", null, "b");
+    void testNullElement() {
+        assertThatThrownBy(() -> new FromElementsFunction<>("a", null, "b"))
+                .hasMessageContaining("contains a null element")
+                .isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void testSetOutputTypeWithNoSerializer() throws Exception {
+    void testSetOutputTypeWithNoSerializer() throws Exception {
         FromElementsFunction<String> source = new FromElementsFunction<>(STRING_ARRAY_DATA);
 
-        assertNull(source.getSerializer());
+        assertThat(source.getSerializer()).isNull();
 
         source.setOutputType(BasicTypeInfo.STRING_TYPE_INFO, new ExecutionConfig());
 
-        assertNotNull(source.getSerializer());
-        assertEquals(
-                BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new SerializerConfigImpl()),
-                source.getSerializer());
+        assertThat(source.getSerializer())
+                .isNotNull()
+                .isEqualTo(
+                        BasicTypeInfo.STRING_TYPE_INFO.createSerializer(
+                                new SerializerConfigImpl()));
 
         List<String> result = runSource(source);
 
-        assertEquals(STRING_LIST_DATA, result);
+        assertThat(result).containsExactly(STRING_ARRAY_DATA);
     }
 
     @Test
-    public void testSetOutputTypeWithSameSerializer() throws Exception {
+    void testSetOutputTypeWithSameSerializer() throws Exception {
         FromElementsFunction<String> source =
                 new FromElementsFunction<>(
                         BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new SerializerConfigImpl()),
@@ -132,25 +115,29 @@ public class FromElementsFunctionTest {
 
         TypeSerializer<String> newSerializer = source.getSerializer();
 
-        assertEquals(existingSerializer, newSerializer);
+        assertThat(newSerializer).isEqualTo(existingSerializer);
 
         List<String> result = runSource(source);
 
-        assertEquals(STRING_LIST_DATA, result);
+        assertThat(result).containsExactly(STRING_ARRAY_DATA);
     }
 
     @Test
     @SuppressWarnings({"unchecked", "rawtypes"})
-    public void testSetOutputTypeWithIncompatibleType() throws Exception {
-        thrown.expect(IllegalArgumentException.class);
-        thrown.expectMessage("not all subclasses of java.lang.Integer");
-
+    void testSetOutputTypeWithIncompatibleType() {
         FromElementsFunction<String> source = new FromElementsFunction<>(STRING_LIST_DATA);
-        source.setOutputType((TypeInformation) BasicTypeInfo.INT_TYPE_INFO, new ExecutionConfig());
+
+        assertThatThrownBy(
+                        () ->
+                                source.setOutputType(
+                                        (TypeInformation) BasicTypeInfo.INT_TYPE_INFO,
+                                        new ExecutionConfig()))
+                .hasMessageContaining("not all subclasses of java.lang.Integer")
+                .isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void testSetOutputTypeWithExistingBrokenSerializer() throws Exception {
+    void testSetOutputTypeWithExistingBrokenSerializer() throws Exception {
         // the original serializer throws an exception
         TypeInformation<DeserializeTooMuchType> info =
                 new ValueTypeInfo<>(DeserializeTooMuchType.class);
@@ -167,56 +154,53 @@ public class FromElementsFunctionTest {
 
         TypeSerializer<DeserializeTooMuchType> newSerializer = source.getSerializer();
 
-        assertNotEquals(existingSerializer, newSerializer);
+        assertThat(newSerializer).isNotEqualTo(existingSerializer);
 
         List<DeserializeTooMuchType> result = runSource(source);
 
-        assertThat(result, hasSize(1));
-        assertThat(result.get(0), instanceOf(DeserializeTooMuchType.class));
+        assertThat(result).hasSize(1).first().isInstanceOf(DeserializeTooMuchType.class);
     }
 
     @Test
-    public void testSetOutputTypeAfterTransferred() throws Exception {
-        thrown.expect(IllegalStateException.class);
-        thrown.expectMessage(
-                "The output type should've been specified before shipping the graph to the cluster");
-
+    void testSetOutputTypeAfterTransferred() throws Exception {
         FromElementsFunction<String> source =
                 InstantiationUtil.clone(new FromElementsFunction<>(STRING_LIST_DATA));
-        source.setOutputType(BasicTypeInfo.STRING_TYPE_INFO, new ExecutionConfig());
+
+        assertThatThrownBy(
+                        () ->
+                                source.setOutputType(
+                                        BasicTypeInfo.STRING_TYPE_INFO, new ExecutionConfig()))
+                .hasMessageContaining(
+                        "The output type should've been specified before shipping the graph to the cluster")
+                .isInstanceOf(IllegalStateException.class);
     }
 
     @Test
-    public void testNoSerializer() throws Exception {
-        thrown.expect(IllegalStateException.class);
-        thrown.expectMessage("serializer not configured");
-
+    void testNoSerializer() {
         FromElementsFunction<String> source = new FromElementsFunction<>(STRING_LIST_DATA);
-        runSource(source);
+
+        assertThatThrownBy(() -> runSource(source))
+                .hasMessageContaining("serializer not configured")
+                .isInstanceOf(IllegalStateException.class);
     }
 
     @Test
-    public void testNonJavaSerializableType() {
-        try {
-            MyPojo[] data = {new MyPojo(1, 2), new MyPojo(3, 4), new MyPojo(5, 6)};
-
-            FromElementsFunction<MyPojo> source =
-                    new FromElementsFunction<MyPojo>(
-                            TypeExtractor.getForClass(MyPojo.class)
-                                    .createSerializer(new SerializerConfigImpl()),
-                            data);
-
-            List<MyPojo> result = runSource(source);
-
-            assertEquals(Arrays.asList(data), result);
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail(e.getMessage());
-        }
+    void testNonJavaSerializableType() throws Exception {
+        MyPojo[] data = {new MyPojo(1, 2), new MyPojo(3, 4), new MyPojo(5, 6)};
+
+        FromElementsFunction<MyPojo> source =
+                new FromElementsFunction<>(
+                        TypeExtractor.getForClass(MyPojo.class)
+                                .createSerializer(new SerializerConfigImpl()),
+                        data);
+
+        List<MyPojo> result = runSource(source);
+
+        assertThat(result).containsExactly(data);
     }
 
     @Test
-    public void testNonJavaSerializableTypeWithSetOutputType() throws Exception {
+    void testNonJavaSerializableTypeWithSetOutputType() throws Exception {
         MyPojo[] data = {new MyPojo(1, 2), new MyPojo(3, 4), new MyPojo(5, 6)};
 
         FromElementsFunction<MyPojo> source = new FromElementsFunction<>(data);
@@ -225,137 +209,100 @@ public class FromElementsFunctionTest {
 
         List<MyPojo> result = runSource(source);
 
-        assertEquals(Arrays.asList(data), result);
+        assertThat(result).containsExactly(data);
+    }
+
+    @Test
+    void testSerializationError() {
+        TypeInformation<SerializationErrorType> info =
+                new ValueTypeInfo<>(SerializationErrorType.class);
+
+        assertThatThrownBy(
+                        () ->
+                                new FromElementsFunction<>(
+                                        info.createSerializer(new SerializerConfigImpl()),
+                                        new SerializationErrorType()))
+                .isInstanceOf(IOException.class)
+                .hasMessageContaining("test exception");
     }
 
     @Test
-    public void testSerializationError() {
-        try {
-            TypeInformation<SerializationErrorType> info =
-                    new ValueTypeInfo<SerializationErrorType>(SerializationErrorType.class);
+    void testDeSerializationError() throws Exception {
+        TypeInformation<DeserializeTooMuchType> info =
+                new ValueTypeInfo<>(DeserializeTooMuchType.class);
 
-            try {
-                new FromElementsFunction<SerializationErrorType>(
+        FromElementsFunction<DeserializeTooMuchType> source =
+                new FromElementsFunction<>(
                         info.createSerializer(new SerializerConfigImpl()),
-                        new SerializationErrorType());
+                        new DeserializeTooMuchType());
 
-                fail("should fail with an exception");
-            } catch (IOException e) {
-                assertTrue(ExceptionUtils.stringifyException(e).contains("test exception"));
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail(e.getMessage());
-        }
+        assertThatThrownBy(() -> source.run(new ListSourceContext<>(new ArrayList<>())))
+                .hasMessageContaining("user-defined serialization")
+                .isInstanceOf(IOException.class);
     }
 
     @Test
-    public void testDeSerializationError() {
-        try {
-            TypeInformation<DeserializeTooMuchType> info =
-                    new ValueTypeInfo<DeserializeTooMuchType>(DeserializeTooMuchType.class);
-
-            FromElementsFunction<DeserializeTooMuchType> source =
-                    new FromElementsFunction<DeserializeTooMuchType>(
-                            info.createSerializer(new SerializerConfigImpl()),
-                            new DeserializeTooMuchType());
-
-            try {
-                source.run(
-                        new ListSourceContext<DeserializeTooMuchType>(
-                                new ArrayList<DeserializeTooMuchType>()));
-                fail("should fail with an exception");
-            } catch (IOException e) {
-                assertTrue(
-                        ExceptionUtils.stringifyException(e)
-                                .contains("user-defined serialization"));
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail(e.getMessage());
-        }
-    }
+    void testCheckpointAndRestore() throws Exception {
+        final int numElements = 10000;
 
-    @Test
-    public void testCheckpointAndRestore() {
-        try {
-            final int numElements = 10000;
+        List<Integer> data = new ArrayList<Integer>(numElements);
+        List<Integer> result = new ArrayList<Integer>(numElements);
 
-            List<Integer> data = new ArrayList<Integer>(numElements);
-            List<Integer> result = new ArrayList<Integer>(numElements);
+        for (int i = 0; i < numElements; i++) {
+            data.add(i);
+        }
 
-            for (int i = 0; i < numElements; i++) {
-                data.add(i);
-            }
+        final FromElementsFunction<Integer> source =
+                new FromElementsFunction<>(IntSerializer.INSTANCE, data);
+        StreamSource<Integer, FromElementsFunction<Integer>> src = new StreamSource<>(source);
+        AbstractStreamOperatorTestHarness<Integer> testHarness =
+                new AbstractStreamOperatorTestHarness<>(src, 1, 1, 0);
+        testHarness.open();
+
+        final SourceFunction.SourceContext<Integer> ctx =
+                new ListSourceContext<Integer>(result, 2L);
+
+        // run the source asynchronously
+        CheckedThread runner =
+                new CheckedThread() {
+                    @Override
+                    public void go() throws Exception {
+                        source.run(ctx);
+                    }
+                };
+        runner.start();
+
+        // wait for a bit
+        Thread.sleep(1000);
+
+        // make a checkpoint
+        List<Integer> checkpointData = new ArrayList<>(numElements);
+        OperatorSubtaskState handles = null;
+        synchronized (ctx.getCheckpointLock()) {
+            handles = testHarness.snapshot(566, System.currentTimeMillis());
+            checkpointData.addAll(result);
+        }
 
-            final FromElementsFunction<Integer> source =
-                    new FromElementsFunction<>(IntSerializer.INSTANCE, data);
-            StreamSource<Integer, FromElementsFunction<Integer>> src = new StreamSource<>(source);
-            AbstractStreamOperatorTestHarness<Integer> testHarness =
-                    new AbstractStreamOperatorTestHarness<>(src, 1, 1, 0);
-            testHarness.open();
-
-            final SourceFunction.SourceContext<Integer> ctx =
-                    new ListSourceContext<Integer>(result, 2L);
-
-            final Throwable[] error = new Throwable[1];
-
-            // run the source asynchronously
-            Thread runner =
-                    new Thread() {
-                        @Override
-                        public void run() {
-                            try {
-                                source.run(ctx);
-                            } catch (Throwable t) {
-                                error[0] = t;
-                            }
-                        }
-                    };
-            runner.start();
-
-            // wait for a bit
-            Thread.sleep(1000);
-
-            // make a checkpoint
-            List<Integer> checkpointData = new ArrayList<>(numElements);
-            OperatorSubtaskState handles = null;
-            synchronized (ctx.getCheckpointLock()) {
-                handles = testHarness.snapshot(566, System.currentTimeMillis());
-                checkpointData.addAll(result);
-            }
+        // cancel the source
+        source.cancel();
+        runner.sync();
 
-            // cancel the source
-            source.cancel();
-            runner.join();
+        final FromElementsFunction<Integer> sourceCopy =
+                new FromElementsFunction<>(IntSerializer.INSTANCE, data);
+        StreamSource<Integer, FromElementsFunction<Integer>> srcCopy =
+                new StreamSource<>(sourceCopy);
+        AbstractStreamOperatorTestHarness<Integer> testHarnessCopy =
+                new AbstractStreamOperatorTestHarness<>(srcCopy, 1, 1, 0);
+        testHarnessCopy.setup();
+        testHarnessCopy.initializeState(handles);
+        testHarnessCopy.open();
 
-            // check for errors
-            if (error[0] != null) {
-                System.err.println("Error in asynchronous source runner");
-                error[0].printStackTrace();
-                fail("Error in asynchronous source runner");
-            }
+        // recovery run
+        SourceFunction.SourceContext<Integer> newCtx = new ListSourceContext<>(checkpointData);
 
-            final FromElementsFunction<Integer> sourceCopy =
-                    new FromElementsFunction<>(IntSerializer.INSTANCE, data);
-            StreamSource<Integer, FromElementsFunction<Integer>> srcCopy =
-                    new StreamSource<>(sourceCopy);
-            AbstractStreamOperatorTestHarness<Integer> testHarnessCopy =
-                    new AbstractStreamOperatorTestHarness<>(srcCopy, 1, 1, 0);
-            testHarnessCopy.setup();
-            testHarnessCopy.initializeState(handles);
-            testHarnessCopy.open();
-
-            // recovery run
-            SourceFunction.SourceContext<Integer> newCtx = new ListSourceContext<>(checkpointData);
-
-            sourceCopy.run(newCtx);
-
-            assertEquals(data, checkpointData);
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail(e.getMessage());
-        }
+        sourceCopy.run(newCtx);
+
+        assertThat(checkpointData).isEqualTo(data);
     }
 
     // ------------------------------------------------------------------------
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/IngestionTimeExtractorTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/IngestionTimeExtractorTest.java
index a892d07f93d..81936cd272b 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/IngestionTimeExtractorTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/IngestionTimeExtractorTest.java
@@ -20,16 +20,15 @@ package org.apache.flink.streaming.api.functions;
 
 import org.apache.flink.streaming.api.watermark.Watermark;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /** Tests for {@link IngestionTimeExtractor}. */
-public class IngestionTimeExtractorTest {
+class IngestionTimeExtractorTest {
 
     @Test
-    public void testMonotonousTimestamps() {
+    void testMonotonousTimestamps() {
         AssignerWithPeriodicWatermarks<String> assigner = new IngestionTimeExtractor<>();
 
         long maxRecordSoFar = 0L;
@@ -38,22 +37,22 @@ public class IngestionTimeExtractorTest {
         for (int i = 0; i < 1343; i++) {
             if (i % 7 == 1) {
                 Watermark mark = assigner.getCurrentWatermark();
-                assertNotNull(mark);
+                assertThat(mark).isNotNull();
 
                 // increasing watermarks
-                assertTrue(mark.getTimestamp() >= maxWatermarkSoFar);
+                assertThat(mark.getTimestamp()).isGreaterThanOrEqualTo(maxWatermarkSoFar);
                 maxWatermarkSoFar = mark.getTimestamp();
 
                 // tight watermarks
-                assertTrue(mark.getTimestamp() >= maxRecordSoFar - 1);
+                assertThat(mark.getTimestamp()).isGreaterThanOrEqualTo(maxRecordSoFar - 1);
             } else {
                 long next = assigner.extractTimestamp("a", Long.MIN_VALUE);
 
                 // increasing timestamps
-                assertTrue(next >= maxRecordSoFar);
+                assertThat(next).isGreaterThanOrEqualTo(maxRecordSoFar);
 
                 // timestamps are never below or at the watermark
-                assertTrue(next > maxWatermarkSoFar);
+                assertThat(next).isGreaterThanOrEqualTo(maxWatermarkSoFar);
 
                 maxRecordSoFar = next;
             }
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/PrintSinkFunctionTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/PrintSinkFunctionTest.java
index 22351c9d0b1..a869b32ccf3 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/PrintSinkFunctionTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/PrintSinkFunctionTest.java
@@ -22,17 +22,17 @@ import org.apache.flink.streaming.api.functions.sink.PrintSinkFunction;
 import org.apache.flink.streaming.api.functions.sink.SinkContextUtil;
 import org.apache.flink.streaming.util.MockStreamingRuntimeContext;
 
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 import java.io.ByteArrayOutputStream;
 import java.io.PrintStream;
 
-import static org.junit.Assert.assertEquals;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /** Tests for the {@link PrintSinkFunction}. */
-public class PrintSinkFunctionTest {
+class PrintSinkFunctionTest {
 
     private final PrintStream originalSystemOut = System.out;
     private final PrintStream originalSystemErr = System.err;
@@ -42,14 +42,14 @@ public class PrintSinkFunctionTest {
 
     private final String line = System.lineSeparator();
 
-    @Before
-    public void setUp() {
+    @BeforeEach
+    void setUp() {
         System.setOut(new PrintStream(arrayOutputStream));
         System.setErr(new PrintStream(arrayErrorStream));
     }
 
-    @After
-    public void tearDown() {
+    @AfterEach
+    void tearDown() {
         if (System.out != originalSystemOut) {
             System.out.close();
         }
@@ -61,7 +61,7 @@ public class PrintSinkFunctionTest {
     }
 
     @Test
-    public void testPrintSinkStdOut() throws Exception {
+    void testPrintSinkStdOut() throws Exception {
         PrintSinkFunction<String> printSink = new PrintSinkFunction<>();
         printSink.setRuntimeContext(new MockStreamingRuntimeContext(false, 1, 0));
 
@@ -69,60 +69,60 @@ public class PrintSinkFunctionTest {
 
         printSink.invoke("hello world!", SinkContextUtil.forTimestamp(0));
 
-        assertEquals("Print to System.out", printSink.toString());
-        assertEquals("hello world!" + line, arrayOutputStream.toString());
+        assertThat(printSink).hasToString("Print to System.out");
+        assertThat(arrayOutputStream).hasToString("hello world!" + line);
         printSink.close();
     }
 
     @Test
-    public void testPrintSinkStdErr() throws Exception {
+    void testPrintSinkStdErr() throws Exception {
         PrintSinkFunction<String> printSink = new PrintSinkFunction<>(true);
         printSink.setRuntimeContext(new MockStreamingRuntimeContext(false, 1, 0));
         printSink.open(DefaultOpenContext.INSTANCE);
 
         printSink.invoke("hello world!", SinkContextUtil.forTimestamp(0));
 
-        assertEquals("Print to System.err", printSink.toString());
-        assertEquals("hello world!" + line, arrayErrorStream.toString());
+        assertThat(printSink).hasToString("Print to System.err");
+        assertThat(arrayErrorStream).hasToString("hello world!" + line);
         printSink.close();
     }
 
     @Test
-    public void testPrintSinkWithPrefix() throws Exception {
+    void testPrintSinkWithPrefix() throws Exception {
         PrintSinkFunction<String> printSink = new PrintSinkFunction<>();
         printSink.setRuntimeContext(new MockStreamingRuntimeContext(false, 2, 1));
         printSink.open(DefaultOpenContext.INSTANCE);
 
         printSink.invoke("hello world!", SinkContextUtil.forTimestamp(0));
 
-        assertEquals("Print to System.out", printSink.toString());
-        assertEquals("2> hello world!" + line, arrayOutputStream.toString());
+        assertThat(printSink).hasToString("Print to System.out");
+        assertThat(arrayOutputStream).hasToString("2> hello world!" + line);
         printSink.close();
     }
 
     @Test
-    public void testPrintSinkWithIdentifierAndPrefix() throws Exception {
+    void testPrintSinkWithIdentifierAndPrefix() throws Exception {
         PrintSinkFunction<String> printSink = new PrintSinkFunction<>("mySink", false);
         printSink.setRuntimeContext(new MockStreamingRuntimeContext(false, 2, 1));
         printSink.open(DefaultOpenContext.INSTANCE);
 
         printSink.invoke("hello world!", SinkContextUtil.forTimestamp(0));
 
-        assertEquals("Print to System.out", printSink.toString());
-        assertEquals("mySink:2> hello world!" + line, arrayOutputStream.toString());
+        assertThat(printSink).hasToString("Print to System.out");
+        assertThat(arrayOutputStream).hasToString("mySink:2> hello world!" + line);
         printSink.close();
     }
 
     @Test
-    public void testPrintSinkWithIdentifierButNoPrefix() throws Exception {
+    void testPrintSinkWithIdentifierButNoPrefix() throws Exception {
         PrintSinkFunction<String> printSink = new PrintSinkFunction<>("mySink", false);
         printSink.setRuntimeContext(new MockStreamingRuntimeContext(false, 1, 0));
         printSink.open(DefaultOpenContext.INSTANCE);
 
         printSink.invoke("hello world!", SinkContextUtil.forTimestamp(0));
 
-        assertEquals("Print to System.out", printSink.toString());
-        assertEquals("mySink> hello world!" + line, arrayOutputStream.toString());
+        assertThat(printSink).hasToString("Print to System.out");
+        assertThat(arrayOutputStream).hasToString("mySink> hello world!" + line);
         printSink.close();
     }
 }
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/PrintSinkTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/PrintSinkTest.java
index 7ecaa123f33..c73ea0b55bd 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/PrintSinkTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/PrintSinkTest.java
@@ -46,7 +46,7 @@ import java.io.ByteArrayOutputStream;
 import java.io.PrintStream;
 import java.util.OptionalLong;
 
-import static org.junit.Assert.assertEquals;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /** Tests for the {@link PrintSink}. */
 class PrintSinkTest {
@@ -84,8 +84,8 @@ class PrintSinkTest {
         try (SinkWriter<String> writer = printSink.createWriter(new MockInitContext(1))) {
             writer.write("hello world!", new MockContext());
 
-            assertEquals("Print to System.out", printSink.toString());
-            assertEquals("hello world!" + line, arrayOutputStream.toString());
+            assertThat(printSink).hasToString("Print to System.out");
+            assertThat(arrayOutputStream).hasToString("hello world!" + line);
         }
     }
 
@@ -96,8 +96,8 @@ class PrintSinkTest {
         try (SinkWriter<String> writer = printSink.createWriter(new MockInitContext(1))) {
             writer.write("hello world!", new MockContext());
 
-            assertEquals("Print to System.err", printSink.toString());
-            assertEquals("hello world!" + line, arrayErrorStream.toString());
+            assertThat(printSink).hasToString("Print to System.err");
+            assertThat(arrayErrorStream).hasToString("hello world!" + line);
         }
     }
 
@@ -108,8 +108,8 @@ class PrintSinkTest {
         try (SinkWriter<String> writer = printSink.createWriter(new MockInitContext(1))) {
             writer.write("hello world!", new MockContext());
 
-            assertEquals("Print to System.err", printSink.toString());
-            assertEquals("mySink> hello world!" + line, arrayErrorStream.toString());
+            assertThat(printSink).hasToString("Print to System.err");
+            assertThat(arrayErrorStream).hasToString("mySink> hello world!" + line);
         }
     }
 
@@ -120,8 +120,8 @@ class PrintSinkTest {
         try (SinkWriter<String> writer = printSink.createWriter(new MockInitContext(2))) {
             writer.write("hello world!", new MockContext());
 
-            assertEquals("Print to System.out", printSink.toString());
-            assertEquals("1> hello world!" + line, arrayOutputStream.toString());
+            assertThat(printSink).hasToString("Print to System.out");
+            assertThat(arrayOutputStream).hasToString("1> hello world!" + line);
         }
     }
 
@@ -132,8 +132,8 @@ class PrintSinkTest {
         try (SinkWriter<String> writer = printSink.createWriter(new MockInitContext(2))) {
             writer.write("hello world!", new MockContext());
 
-            assertEquals("Print to System.out", printSink.toString());
-            assertEquals("mySink:1> hello world!" + line, arrayOutputStream.toString());
+            assertThat(printSink).hasToString("Print to System.out");
+            assertThat(arrayOutputStream).hasToString("mySink:1> hello world!" + line);
         }
     }
 
@@ -144,8 +144,8 @@ class PrintSinkTest {
         try (SinkWriter<String> writer = printSink.createWriter(new MockInitContext(1))) {
             writer.write("hello world!", new MockContext());
 
-            assertEquals("Print to System.out", printSink.toString());
-            assertEquals("mySink> hello world!" + line, arrayOutputStream.toString());
+            assertThat(printSink).hasToString("Print to System.out");
+            assertThat(arrayOutputStream).hasToString("mySink> hello world!" + line);
         }
     }
 
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/StatefulSequenceSourceTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/StatefulSequenceSourceTest.java
index ca0571a8f90..83ad164a4fe 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/StatefulSequenceSourceTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/StatefulSequenceSourceTest.java
@@ -18,29 +18,29 @@
 
 package org.apache.flink.streaming.api.functions;
 
+import org.apache.flink.core.testutils.CheckedThread;
 import org.apache.flink.core.testutils.OneShotLatch;
 import org.apache.flink.runtime.checkpoint.OperatorSubtaskState;
-import org.apache.flink.streaming.api.functions.source.SourceFunction;
 import org.apache.flink.streaming.api.functions.source.StatefulSequenceSource;
 import org.apache.flink.streaming.api.operators.StreamSource;
-import org.apache.flink.streaming.api.watermark.Watermark;
 import org.apache.flink.streaming.util.AbstractStreamOperatorTestHarness;
+import org.apache.flink.streaming.util.BlockingSourceContext;
 
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 /** Tests for {@link StatefulSequenceSource}. */
-public class StatefulSequenceSourceTest {
+class StatefulSequenceSourceTest {
 
     @Test
-    public void testCheckpointRestore() throws Exception {
+    void testCheckpointRestore() throws Exception {
         final int initElement = 0;
         final int maxElement = 100;
         final int maxParallelsim = 2;
@@ -70,45 +70,25 @@ public class StatefulSequenceSourceTest {
                 new AbstractStreamOperatorTestHarness<>(src2, maxParallelsim, 2, 1);
         testHarness2.open();
 
-        final Throwable[] error = new Throwable[3];
-
         // run the source asynchronously
-        Thread runner1 =
-                new Thread() {
+        CheckedThread runner1 =
+                new CheckedThread() {
                     @Override
-                    public void run() {
-                        try {
-                            source1.run(
-                                    new BlockingSourceContext<>(
-                                            "1",
-                                            latchToTrigger1,
-                                            latchToWait1,
-                                            outputCollector,
-                                            21));
-                        } catch (Throwable t) {
-                            t.printStackTrace();
-                            error[0] = t;
-                        }
+                    public void go() throws Exception {
+                        source1.run(
+                                new BlockingSourceContext<>(
+                                        "1", latchToTrigger1, latchToWait1, outputCollector, 21));
                     }
                 };
 
         // run the source asynchronously
-        Thread runner2 =
-                new Thread() {
+        CheckedThread runner2 =
+                new CheckedThread() {
                     @Override
-                    public void run() {
-                        try {
-                            source2.run(
-                                    new BlockingSourceContext<>(
-                                            "2",
-                                            latchToTrigger2,
-                                            latchToWait2,
-                                            outputCollector,
-                                            32));
-                        } catch (Throwable t) {
-                            t.printStackTrace();
-                            error[1] = t;
-                        }
+                    public void go() throws Exception {
+                        source2.run(
+                                new BlockingSourceContext<>(
+                                        "2", latchToTrigger2, latchToWait2, outputCollector, 32));
                     }
                 };
 
@@ -145,28 +125,19 @@ public class StatefulSequenceSourceTest {
         latchToWait3.trigger();
 
         // run the source asynchronously
-        Thread runner3 =
-                new Thread() {
+        CheckedThread runner3 =
+                new CheckedThread() {
                     @Override
-                    public void run() {
-                        try {
-                            source3.run(
-                                    new BlockingSourceContext<>(
-                                            "3",
-                                            latchToTrigger3,
-                                            latchToWait3,
-                                            outputCollector,
-                                            3));
-                        } catch (Throwable t) {
-                            t.printStackTrace();
-                            error[2] = t;
-                        }
+                    public void go() throws Exception {
+                        source3.run(
+                                new BlockingSourceContext<>(
+                                        "3", latchToTrigger3, latchToWait3, outputCollector, 3));
                     }
                 };
         runner3.start();
-        runner3.join();
+        runner3.sync();
 
-        Assert.assertEquals(3, outputCollector.size()); // we have 3 tasks.
+        assertThat(outputCollector).hasSize(3); // we have 3 tasks.
 
         // test for at-most-once
         Set<Long> dedupRes = new HashSet<>(Math.abs(maxElement - initElement) + 1);
@@ -175,101 +146,25 @@ public class StatefulSequenceSourceTest {
             List<Long> elements = outputCollector.get(key);
 
             // this tests the correctness of the latches in the test
-            Assert.assertTrue(elements.size() > 0);
+            assertThat(elements).isNotEmpty();
 
             for (Long elem : elements) {
-                if (!dedupRes.add(elem)) {
-                    Assert.fail("Duplicate entry: " + elem);
-                }
+                assertThat(dedupRes.add(elem)).as("Duplicate entry: " + elem).isTrue();
 
-                if (!expectedOutput.contains(elem)) {
-                    Assert.fail("Unexpected element: " + elem);
-                }
+                assertThat(expectedOutput.contains(elem))
+                        .as("Unexpected element: " + elem)
+                        .isTrue();
             }
         }
 
         // test for exactly-once
-        Assert.assertEquals(Math.abs(initElement - maxElement) + 1, dedupRes.size());
+        assertThat(dedupRes).hasSize(Math.abs(initElement - maxElement) + 1);
 
         latchToWait1.trigger();
         latchToWait2.trigger();
 
         // wait for everybody ot finish.
-        runner1.join();
-        runner2.join();
-    }
-
-    /** Test SourceContext. */
-    public static class BlockingSourceContext<T> implements SourceFunction.SourceContext<T> {
-
-        private final String name;
-
-        private final Object lock;
-        private final OneShotLatch latchToTrigger;
-        private final OneShotLatch latchToWait;
-        private final ConcurrentHashMap<String, List<T>> collector;
-
-        private final int threshold;
-        private int counter = 0;
-
-        private final List<T> localOutput;
-
-        public BlockingSourceContext(
-                String name,
-                OneShotLatch latchToTrigger,
-                OneShotLatch latchToWait,
-                ConcurrentHashMap<String, List<T>> output,
-                int elemToFire) {
-            this.name = name;
-            this.lock = new Object();
-            this.latchToTrigger = latchToTrigger;
-            this.latchToWait = latchToWait;
-            this.collector = output;
-            this.threshold = elemToFire;
-
-            this.localOutput = new ArrayList<>();
-            List<T> prev = collector.put(name, localOutput);
-            if (prev != null) {
-                Assert.fail();
-            }
-        }
-
-        @Override
-        public void collectWithTimestamp(T element, long timestamp) {
-            collect(element);
-        }
-
-        @Override
-        public void collect(T element) {
-            localOutput.add(element);
-            if (++counter == threshold) {
-                latchToTrigger.trigger();
-                try {
-                    if (!latchToWait.isTriggered()) {
-                        latchToWait.await();
-                    }
-                } catch (InterruptedException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-
-        @Override
-        public void emitWatermark(Watermark mark) {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public void markAsTemporarilyIdle() {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public Object getCheckpointLock() {
-            return lock;
-        }
-
-        @Override
-        public void close() {}
+        runner1.sync();
+        runner2.sync();
     }
 }
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/async/RichAsyncFunctionTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/async/RichAsyncFunctionTest.java
index 180fe4570d0..076cb1d66c0 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/async/RichAsyncFunctionTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/async/RichAsyncFunctionTest.java
@@ -21,7 +21,6 @@ package org.apache.flink.streaming.api.functions.async;
 import org.apache.flink.api.common.TaskInfo;
 import org.apache.flink.api.common.accumulators.Accumulator;
 import org.apache.flink.api.common.functions.AggregateFunction;
-import org.apache.flink.api.common.functions.BroadcastVariableInitializer;
 import org.apache.flink.api.common.functions.IterationRuntimeContext;
 import org.apache.flink.api.common.functions.ReduceFunction;
 import org.apache.flink.api.common.functions.RuntimeContext;
@@ -33,25 +32,25 @@ import org.apache.flink.api.common.state.ValueStateDescriptor;
 import org.apache.flink.metrics.groups.OperatorMetricGroup;
 import org.apache.flink.metrics.groups.UnregisteredMetricsGroup;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import java.util.HashMap;
 import java.util.Map;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
 /** Test cases for {@link RichAsyncFunction}. */
-public class RichAsyncFunctionTest {
+class RichAsyncFunctionTest {
 
     /**
      * Test the set of iteration runtime context methods in the context of a {@link
      * RichAsyncFunction}.
      */
     @Test
-    public void testIterationRuntimeContext() throws Exception {
+    void testIterationRuntimeContext() {
         RichAsyncFunction<Integer, Integer> function =
                 new RichAsyncFunction<Integer, Integer>() {
                     private static final long serialVersionUID = -2023923961609455894L;
@@ -71,27 +70,18 @@ public class RichAsyncFunctionTest {
 
         IterationRuntimeContext iterationRuntimeContext = function.getIterationRuntimeContext();
 
-        assertEquals(superstepNumber, iterationRuntimeContext.getSuperstepNumber());
-
-        try {
-            iterationRuntimeContext.getIterationAggregator("foobar");
-            fail("Expected getIterationAggregator to fail with unsupported operation exception");
-        } catch (UnsupportedOperationException e) {
-            // expected
-        }
-
-        try {
-            iterationRuntimeContext.getPreviousIterationAggregate("foobar");
-            fail(
-                    "Expected getPreviousIterationAggregator to fail with unsupported operation exception");
-        } catch (UnsupportedOperationException e) {
-            // expected
-        }
+        assertThat(iterationRuntimeContext.getSuperstepNumber()).isEqualTo(superstepNumber);
+
+        assertThatThrownBy(() -> iterationRuntimeContext.getIterationAggregator("foobar"))
+                .isInstanceOf(UnsupportedOperationException.class);
+
+        assertThatThrownBy(() -> iterationRuntimeContext.getPreviousIterationAggregate("foobar"))
+                .isInstanceOf(UnsupportedOperationException.class);
     }
 
     /** Test the set of runtime context methods in the context of a {@link RichAsyncFunction}. */
     @Test
-    public void testRuntimeContext() throws Exception {
+    void testRuntimeContext() {
         RichAsyncFunction<Integer, Integer> function =
                 new RichAsyncFunction<Integer, Integer>() {
                     private static final long serialVersionUID = 1707630162838967972L;
@@ -132,190 +122,149 @@ public class RichAsyncFunctionTest {
 
         RuntimeContext runtimeContext = function.getRuntimeContext();
 
-        assertEquals(taskName, runtimeContext.getTaskInfo().getTaskName());
-        assertEquals(metricGroup, runtimeContext.getMetricGroup());
-        assertEquals(
-                numberOfParallelSubtasks,
-                runtimeContext.getTaskInfo().getNumberOfParallelSubtasks());
-        assertEquals(indexOfSubtask, runtimeContext.getTaskInfo().getIndexOfThisSubtask());
-        assertEquals(attemptNumber, runtimeContext.getTaskInfo().getAttemptNumber());
-        assertEquals(taskNameWithSubtask, runtimeContext.getTaskInfo().getTaskNameWithSubtasks());
-        assertEquals(globalJobParameters, runtimeContext.getGlobalJobParameters());
-        assertEquals(isObjectReused, runtimeContext.isObjectReuseEnabled());
-        assertEquals(userCodeClassLoader, runtimeContext.getUserCodeClassLoader());
-
-        try {
-            runtimeContext.getDistributedCache();
-            fail("Expected getDistributedCached to fail with unsupported operation exception.");
-        } catch (UnsupportedOperationException e) {
-            // expected
-        }
-
-        try {
-            runtimeContext.getState(new ValueStateDescriptor<>("foobar", Integer.class, 42));
-            fail("Expected getState to fail with unsupported operation exception.");
-        } catch (UnsupportedOperationException e) {
-            // expected
-        }
-
-        try {
-            runtimeContext.getListState(new ListStateDescriptor<>("foobar", Integer.class));
-            fail("Expected getListState to fail with unsupported operation exception.");
-        } catch (UnsupportedOperationException e) {
-            // expected
-        }
-
-        try {
-            runtimeContext.getReducingState(
-                    new ReducingStateDescriptor<>(
-                            "foobar",
-                            new ReduceFunction<Integer>() {
-                                private static final long serialVersionUID = 2136425961884441050L;
-
-                                @Override
-                                public Integer reduce(Integer value1, Integer value2)
-                                        throws Exception {
-                                    return value1;
-                                }
-                            },
-                            Integer.class));
-            fail("Expected getReducingState to fail with unsupported operation exception.");
-        } catch (UnsupportedOperationException e) {
-            // expected
-        }
-
-        try {
-            runtimeContext.getAggregatingState(
-                    new AggregatingStateDescriptor<>(
-                            "foobar",
-                            new AggregateFunction<Integer, Integer, Integer>() {
-
-                                @Override
-                                public Integer createAccumulator() {
-                                    return null;
-                                }
-
-                                @Override
-                                public Integer add(Integer value, Integer accumulator) {
-                                    return null;
-                                }
-
-                                @Override
-                                public Integer getResult(Integer accumulator) {
-                                    return null;
-                                }
-
-                                @Override
-                                public Integer merge(Integer a, Integer b) {
-                                    return null;
-                                }
-                            },
-                            Integer.class));
-        } catch (UnsupportedOperationException e) {
-            // expected
-        }
-
-        try {
-            runtimeContext.getMapState(
-                    new MapStateDescriptor<>("foobar", Integer.class, String.class));
-        } catch (UnsupportedOperationException e) {
-            // expected
-        }
-
-        try {
-            runtimeContext.addAccumulator(
-                    "foobar",
-                    new Accumulator<Integer, Integer>() {
-                        private static final long serialVersionUID = -4673320336846482358L;
-
-                        @Override
-                        public void add(Integer value) {
-                            // no op
-                        }
-
-                        @Override
-                        public Integer getLocalValue() {
-                            return null;
-                        }
-
-                        @Override
-                        public void resetLocal() {}
-
-                        @Override
-                        public void merge(Accumulator<Integer, Integer> other) {}
-
-                        @Override
-                        public Accumulator<Integer, Integer> clone() {
-                            return null;
-                        }
-                    });
-            fail("Expected addAccumulator to fail with unsupported operation exception.");
-        } catch (UnsupportedOperationException e) {
-            // expected
-        }
-
-        try {
-            runtimeContext.getAccumulator("foobar");
-            fail("Expected getAccumulator to fail with unsupported operation exception.");
-        } catch (UnsupportedOperationException e) {
-            // expected
-        }
-
-        try {
-            runtimeContext.getIntCounter("foobar");
-            fail("Expected getIntCounter to fail with unsupported operation exception.");
-        } catch (UnsupportedOperationException e) {
-            // expected
-        }
-
-        try {
-            runtimeContext.getLongCounter("foobar");
-            fail("Expected getLongCounter to fail with unsupported operation exception.");
-        } catch (UnsupportedOperationException e) {
-            // expected
-        }
-
-        try {
-            runtimeContext.getDoubleCounter("foobar");
-            fail("Expected getDoubleCounter to fail with unsupported operation exception.");
-        } catch (UnsupportedOperationException e) {
-            // expected
-        }
-
-        try {
-            runtimeContext.getHistogram("foobar");
-            fail("Expected getHistogram to fail with unsupported operation exception.");
-        } catch (UnsupportedOperationException e) {
-            // expected
-        }
-
-        try {
-            runtimeContext.hasBroadcastVariable("foobar");
-            fail("Expected hasBroadcastVariable to fail with unsupported operation exception.");
-        } catch (UnsupportedOperationException e) {
-            // expected
-        }
-
-        try {
-            runtimeContext.getBroadcastVariable("foobar");
-            fail("Expected getBroadcastVariable to fail with unsupported operation exception.");
-        } catch (UnsupportedOperationException e) {
-            // expected
-        }
-
-        try {
-            runtimeContext.getBroadcastVariableWithInitializer(
-                    "foobar",
-                    new BroadcastVariableInitializer<Object, Object>() {
-                        @Override
-                        public Object initializeBroadcastVariable(Iterable<Object> data) {
-                            return null;
-                        }
-                    });
-            fail(
-                    "Expected getBroadcastVariableWithInitializer to fail with unsupported operation exception.");
-        } catch (UnsupportedOperationException e) {
-            // expected
-        }
+        assertThat(runtimeContext.getTaskInfo().getTaskName()).isEqualTo(taskName);
+        assertThat(runtimeContext.getMetricGroup()).isEqualTo(metricGroup);
+        assertThat(runtimeContext.getTaskInfo().getNumberOfParallelSubtasks())
+                .isEqualTo(numberOfParallelSubtasks);
+        assertThat(runtimeContext.getTaskInfo().getIndexOfThisSubtask()).isEqualTo(indexOfSubtask);
+        assertThat(runtimeContext.getTaskInfo().getAttemptNumber()).isEqualTo(attemptNumber);
+        assertThat(runtimeContext.getTaskInfo().getTaskNameWithSubtasks())
+                .isEqualTo(taskNameWithSubtask);
+        assertThat(runtimeContext.getGlobalJobParameters()).isEqualTo(globalJobParameters);
+        assertThat(runtimeContext.isObjectReuseEnabled()).isEqualTo(isObjectReused);
+        assertThat(runtimeContext.getUserCodeClassLoader()).isEqualTo(userCodeClassLoader);
+
+        assertThatThrownBy(runtimeContext::getDistributedCache)
+                .isInstanceOf(UnsupportedOperationException.class);
+
+        assertThatThrownBy(
+                        () ->
+                                runtimeContext.getState(
+                                        new ValueStateDescriptor<>("foobar", Integer.class, 42)))
+                .isInstanceOf(UnsupportedOperationException.class);
+
+        assertThatThrownBy(
+                        () ->
+                                runtimeContext.getListState(
+                                        new ListStateDescriptor<>("foobar", Integer.class)))
+                .isInstanceOf(UnsupportedOperationException.class);
+
+        assertThatThrownBy(
+                        () ->
+                                runtimeContext.getReducingState(
+                                        new ReducingStateDescriptor<>(
+                                                "foobar",
+                                                new ReduceFunction<Integer>() {
+                                                    private static final long serialVersionUID =
+                                                            2136425961884441050L;
+
+                                                    @Override
+                                                    public Integer reduce(
+                                                            Integer value1, Integer value2) {
+                                                        return value1;
+                                                    }
+                                                },
+                                                Integer.class)))
+                .isInstanceOf(UnsupportedOperationException.class);
+
+        assertThatThrownBy(
+                        () ->
+                                runtimeContext.getAggregatingState(
+                                        new AggregatingStateDescriptor<>(
+                                                "foobar",
+                                                new AggregateFunction<Integer, Integer, Integer>() {
+
+                                                    @Override
+                                                    public Integer createAccumulator() {
+                                                        return null;
+                                                    }
+
+                                                    @Override
+                                                    public Integer add(
+                                                            Integer value, Integer accumulator) {
+                                                        return null;
+                                                    }
+
+                                                    @Override
+                                                    public Integer getResult(Integer accumulator) {
+                                                        return null;
+                                                    }
+
+                                                    @Override
+                                                    public Integer merge(Integer a, Integer b) {
+                                                        return null;
+                                                    }
+                                                },
+                                                Integer.class)))
+                .isInstanceOf(UnsupportedOperationException.class);
+
+        assertThatThrownBy(
+                        () ->
+                                runtimeContext.getMapState(
+                                        new MapStateDescriptor<>(
+                                                "foobar", Integer.class, String.class)))
+                .isInstanceOf(UnsupportedOperationException.class);
+
+        assertThatThrownBy(
+                        () ->
+                                runtimeContext.addAccumulator(
+                                        "foobar",
+                                        new Accumulator<Integer, Integer>() {
+                                            private static final long serialVersionUID =
+                                                    -4673320336846482358L;
+
+                                            @Override
+                                            public void add(Integer value) {
+                                                // no op
+                                            }
+
+                                            @Override
+                                            public Integer getLocalValue() {
+                                                return null;
+                                            }
+
+                                            @Override
+                                            public void resetLocal() {}
+
+                                            @Override
+                                            public void merge(
+                                                    Accumulator<Integer, Integer> other) {}
+
+                                            @Override
+                                            public Accumulator<Integer, Integer> clone() {
+                                                return null;
+                                            }
+                                        }))
+                .isInstanceOf(UnsupportedOperationException.class);
+
+        assertThatThrownBy(() -> runtimeContext.getAccumulator("foobar"))
+                .isInstanceOf(UnsupportedOperationException.class);
+
+        assertThatThrownBy(() -> runtimeContext.getIntCounter("foobar"))
+                .isInstanceOf(UnsupportedOperationException.class);
+
+        assertThatThrownBy(() -> runtimeContext.getLongCounter("foobar"))
+                .isInstanceOf(UnsupportedOperationException.class);
+
+        assertThatThrownBy(() -> runtimeContext.getDoubleCounter("foobar"))
+                .isInstanceOf(UnsupportedOperationException.class);
+
+        assertThatThrownBy(() -> runtimeContext.getHistogram("foobar"))
+                .isInstanceOf(UnsupportedOperationException.class);
+
+        assertThatThrownBy(() -> runtimeContext.getBroadcastVariable("foobar"))
+                .isInstanceOf(UnsupportedOperationException.class);
+
+        assertThatThrownBy(() -> runtimeContext.hasBroadcastVariable("foobar"))
+                .isInstanceOf(UnsupportedOperationException.class);
+
+        assertThatThrownBy(() -> runtimeContext.getBroadcastVariable("foobar"))
+                .isInstanceOf(UnsupportedOperationException.class);
+
+        assertThatThrownBy(
+                        () ->
+                                runtimeContext.getBroadcastVariableWithInitializer(
+                                        "foobar", data -> null))
+                .isInstanceOf(UnsupportedOperationException.class);
     }
 }
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/OutputFormatSinkFunctionTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/OutputFormatSinkFunctionTest.java
index 43406ff9885..83726339f75 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/OutputFormatSinkFunctionTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/OutputFormatSinkFunctionTest.java
@@ -22,14 +22,14 @@ import org.apache.flink.api.common.functions.RuntimeContext;
 import org.apache.flink.api.common.io.OutputFormat;
 import org.apache.flink.api.common.io.RichOutputFormat;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.mockito.Mockito;
 
 /** Tests for {@link OutputFormatSinkFunction}. */
-public class OutputFormatSinkFunctionTest {
+class OutputFormatSinkFunctionTest {
 
     @Test
-    public void setRuntimeContext() throws Exception {
+    void setRuntimeContext() {
         RuntimeContext mockRuntimeContext = Mockito.mock(RuntimeContext.class);
 
         // Make sure setRuntimeContext of the rich output format is called
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/SocketClientSinkTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/SocketClientSinkTest.java
index a5a52e272fa..c41f2c138cd 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/SocketClientSinkTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/SocketClientSinkTest.java
@@ -21,12 +21,12 @@ package org.apache.flink.streaming.api.functions.sink;
 import org.apache.flink.api.common.functions.DefaultOpenContext;
 import org.apache.flink.api.common.serialization.SerializationSchema;
 import org.apache.flink.configuration.ConfigConstants;
+import org.apache.flink.core.testutils.CheckedThread;
 import org.apache.flink.util.NetUtils;
-import org.apache.flink.util.TestLogger;
 
 import org.apache.commons.io.IOUtils;
 import org.junit.AssumptionViolatedException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import java.io.BufferedReader;
 import java.io.IOException;
@@ -39,15 +39,12 @@ import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
-import java.util.concurrent.atomic.AtomicReference;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 /** Tests for the {@link org.apache.flink.streaming.api.functions.sink.SocketClientSink}. */
-@SuppressWarnings("serial")
-public class SocketClientSinkTest extends TestLogger {
+class SocketClientSinkTest {
 
     private static final String TEST_MESSAGE = "testSocketSinkInvoke";
 
@@ -65,25 +62,19 @@ public class SocketClientSinkTest extends TestLogger {
             };
 
     @Test
-    public void testSocketSink() throws Exception {
+    void testSocketSink() throws Exception {
         final ServerSocket server = new ServerSocket(0);
         final int port = server.getLocalPort();
 
-        final AtomicReference<Throwable> error = new AtomicReference<Throwable>();
-
-        Thread sinkRunner =
-                new Thread("Test sink runner") {
+        CheckedThread sinkRunner =
+                new CheckedThread("Test sink runner") {
                     @Override
-                    public void run() {
-                        try {
-                            SocketClientSink<String> simpleSink =
-                                    new SocketClientSink<>(host, port, simpleSchema, 0);
-                            simpleSink.open(DefaultOpenContext.INSTANCE);
-                            simpleSink.invoke(TEST_MESSAGE + '\n', SinkContextUtil.forTimestamp(0));
-                            simpleSink.close();
-                        } catch (Throwable t) {
-                            error.set(t);
-                        }
+                    public void go() throws Exception {
+                        SocketClientSink<String> simpleSink =
+                                new SocketClientSink<>(host, port, simpleSchema, 0);
+                        simpleSink.open(DefaultOpenContext.INSTANCE);
+                        simpleSink.invoke(TEST_MESSAGE + '\n', SinkContextUtil.forTimestamp(0));
+                        simpleSink.close();
                     }
                 };
 
@@ -94,20 +85,14 @@ public class SocketClientSinkTest extends TestLogger {
 
         String value = rdr.readLine();
 
-        sinkRunner.join();
+        sinkRunner.sync();
         server.close();
 
-        if (error.get() != null) {
-            Throwable t = error.get();
-            t.printStackTrace();
-            fail("Error in spawned thread: " + t.getMessage());
-        }
-
-        assertEquals(TEST_MESSAGE, value);
+        assertThat(value).isEqualTo(TEST_MESSAGE);
     }
 
     @Test
-    public void testSinkAutoFlush() throws Exception {
+    void testSinkAutoFlush() throws Exception {
         final ServerSocket server = new ServerSocket(0);
         final int port = server.getLocalPort();
 
@@ -115,19 +100,13 @@ public class SocketClientSinkTest extends TestLogger {
                 new SocketClientSink<>(host, port, simpleSchema, 0, true);
         simpleSink.open(DefaultOpenContext.INSTANCE);
 
-        final AtomicReference<Throwable> error = new AtomicReference<Throwable>();
-
-        Thread sinkRunner =
-                new Thread("Test sink runner") {
+        CheckedThread sinkRunner =
+                new CheckedThread("Test sink runner") {
                     @Override
-                    public void run() {
-                        try {
-                            // need two messages here: send a fin to cancel the client
-                            // state:FIN_WAIT_2 while the server is CLOSE_WAIT
-                            simpleSink.invoke(TEST_MESSAGE + '\n', SinkContextUtil.forTimestamp(0));
-                        } catch (Throwable t) {
-                            error.set(t);
-                        }
+                    public void go() throws Exception {
+                        // need two messages here: send a fin to cancel the client
+                        // state:FIN_WAIT_2 while the server is CLOSE_WAIT
+                        simpleSink.invoke(TEST_MESSAGE + '\n', SinkContextUtil.forTimestamp(0));
                     }
                 };
 
@@ -137,38 +116,26 @@ public class SocketClientSinkTest extends TestLogger {
         BufferedReader rdr = new BufferedReader(new InputStreamReader(sk.getInputStream()));
         String value = rdr.readLine();
 
-        sinkRunner.join();
+        sinkRunner.sync();
         simpleSink.close();
         server.close();
 
-        if (error.get() != null) {
-            Throwable t = error.get();
-            t.printStackTrace();
-            fail("Error in spawned thread: " + t.getMessage());
-        }
-
-        assertEquals(TEST_MESSAGE, value);
+        assertThat(value).isEqualTo(TEST_MESSAGE);
     }
 
     @Test
-    public void testSocketSinkNoRetry() throws Exception {
+    void testSocketSinkNoRetry() throws Exception {
         final ServerSocket server = new ServerSocket(0);
         final int port = server.getLocalPort();
 
         try {
-            final AtomicReference<Throwable> error = new AtomicReference<Throwable>();
-
-            Thread serverRunner =
-                    new Thread("Test server runner") {
+            CheckedThread serverRunner =
+                    new CheckedThread("Test server runner") {
 
                         @Override
-                        public void run() {
-                            try {
-                                Socket sk = NetUtils.acceptWithoutTimeout(server);
-                                sk.close();
-                            } catch (Throwable t) {
-                                error.set(t);
-                            }
+                        public void go() throws Exception {
+                            Socket sk = NetUtils.acceptWithoutTimeout(server);
+                            sk.close();
                         }
                     };
             serverRunner.start();
@@ -178,36 +145,33 @@ public class SocketClientSinkTest extends TestLogger {
             simpleSink.open(DefaultOpenContext.INSTANCE);
 
             // wait socket server to close
-            serverRunner.join();
-            if (error.get() != null) {
-                Throwable t = error.get();
-                t.printStackTrace();
-                fail("Error in server thread: " + t.getMessage());
-            }
-
-            try {
-                // socket should be closed, so this should trigger a re-try
-                // need two messages here: send a fin to cancel the client state:FIN_WAIT_2 while
-                // the server is CLOSE_WAIT
-                while (true) { // we have to do this more often as the server side closed is not
-                    // guaranteed to be noticed immediately
-                    simpleSink.invoke(TEST_MESSAGE + '\n', SinkContextUtil.forTimestamp(0));
-                }
-            } catch (IOException e) {
-                // check whether throw a exception that reconnect failed.
-                assertTrue("Wrong exception", e.getMessage().contains(EXCEPTION_MESSGAE));
-            } catch (Exception e) {
-                fail("wrong exception: " + e.getClass().getName() + " - " + e.getMessage());
-            }
-
-            assertEquals(0, simpleSink.getCurrentNumberOfRetries());
+            serverRunner.sync();
+
+            assertThatThrownBy(
+                            () -> {
+                                // socket should be closed, so this should trigger a re-try
+                                // need two messages here: send a fin to cancel the client
+                                // state:FIN_WAIT_2 while
+                                // the server is CLOSE_WAIT
+                                while (true) { // we have to do this more often as the server side
+                                    // closed is not
+                                    // guaranteed to be noticed immediately
+                                    simpleSink.invoke(
+                                            TEST_MESSAGE + '\n', SinkContextUtil.forTimestamp(0));
+                                }
+                            })
+                    // check whether throw a exception that reconnect failed.
+                    .isInstanceOf(IOException.class)
+                    .hasMessageContaining(EXCEPTION_MESSGAE);
+
+            assertThat(simpleSink.getCurrentNumberOfRetries()).isZero();
         } finally {
             IOUtils.closeQuietly(server);
         }
     }
 
     @Test
-    public void testRetry() throws Exception {
+    void testRetry() throws Exception {
 
         final ServerSocket[] serverSocket = new ServerSocket[1];
         final ExecutorService[] executor = new ExecutorService[1];
@@ -229,7 +193,7 @@ public class SocketClientSinkTest extends TestLogger {
                                             new InputStreamReader(socket.getInputStream()));
 
                             String value = reader.readLine();
-                            assertEquals("0", value);
+                            assertThat(value).isEqualTo("0");
 
                             socket.close();
                             return null;
@@ -255,10 +219,10 @@ public class SocketClientSinkTest extends TestLogger {
 
             // Shutdown the server socket
             serverSocket[0].close();
-            assertTrue(serverSocket[0].isClosed());
+            assertThat(serverSocket[0].isClosed()).isTrue();
 
             // No retries expected at this point
-            assertEquals(0, sink.getCurrentNumberOfRetries());
+            assertThat(sink.getCurrentNumberOfRetries()).isZero();
 
             final CountDownLatch retryLatch = new CountDownLatch(1);
             final CountDownLatch again = new CountDownLatch(1);
@@ -305,7 +269,7 @@ public class SocketClientSinkTest extends TestLogger {
             // Wait for the reconnect
             String value = reader.readLine();
 
-            assertEquals("1", value);
+            assertThat(value).isEqualTo("1");
 
             // OK the sink re-connected. :)
         } finally {
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/TransactionHolderTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/TransactionHolderTest.java
index e0469de65b7..7d0a7640a6f 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/TransactionHolderTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/TransactionHolderTest.java
@@ -19,23 +19,22 @@ package org.apache.flink.streaming.api.functions.sink;
 
 import org.apache.flink.streaming.api.functions.sink.TwoPhaseCommitSinkFunction.TransactionHolder;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import java.time.Clock;
 import java.time.Instant;
 import java.time.ZoneOffset;
 
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.equalTo;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /** Unit tests {@link TransactionHolder}. */
-public class TransactionHolderTest {
+class TransactionHolderTest {
 
     @Test
-    public void testElapsedTime() {
+    void testElapsedTime() {
         final long elapsedTime =
                 new TransactionHolder<>(new Object(), 0)
                         .elapsedTime(Clock.fixed(Instant.ofEpochMilli(1000), ZoneOffset.UTC));
-        assertThat(elapsedTime, equalTo(1000L));
+        assertThat(elapsedTime).isEqualTo(1000L);
     }
 }
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/TwoPhaseCommitSinkFunctionTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/TwoPhaseCommitSinkFunctionTest.java
index d2a5f8e0a52..9361edbf440 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/TwoPhaseCommitSinkFunctionTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/TwoPhaseCommitSinkFunctionTest.java
@@ -25,15 +25,14 @@ import org.apache.flink.runtime.checkpoint.OperatorSubtaskState;
 import org.apache.flink.streaming.api.operators.StreamSink;
 import org.apache.flink.streaming.util.ContentDump;
 import org.apache.flink.streaming.util.OneInputStreamOperatorTestHarness;
-import org.apache.flink.testutils.logging.TestLoggerResource;
+import org.apache.flink.testutils.logging.LoggerAuditingExtension;
 
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.slf4j.event.Level;
 
-import java.io.IOException;
 import java.time.Clock;
 import java.time.Instant;
 import java.time.ZoneId;
@@ -45,14 +44,11 @@ import java.util.List;
 import java.util.UUID;
 import java.util.concurrent.atomic.AtomicBoolean;
 
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.hamcrest.CoreMatchers.hasItem;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 /** Tests for {@link TwoPhaseCommitSinkFunction}. */
-public class TwoPhaseCommitSinkFunctionTest {
+class TwoPhaseCommitSinkFunctionTest {
 
     private ContentDumpSinkFunction sinkFunction;
 
@@ -66,12 +62,12 @@ public class TwoPhaseCommitSinkFunctionTest {
 
     private SettableClock clock;
 
-    @Rule
-    public final TestLoggerResource testLoggerResource =
-            new TestLoggerResource(TwoPhaseCommitSinkFunction.class, Level.WARN);
+    @RegisterExtension
+    private LoggerAuditingExtension testLoggerResource =
+            new LoggerAuditingExtension(TwoPhaseCommitSinkFunction.class, Level.WARN);
 
-    @Before
-    public void setUp() throws Exception {
+    @BeforeEach
+    void setUp() throws Exception {
         targetDirectory = new ContentDump();
         tmpDirectory = new ContentDump();
         clock = new SettableClock();
@@ -79,8 +75,8 @@ public class TwoPhaseCommitSinkFunctionTest {
         setUpTestHarness();
     }
 
-    @After
-    public void tearDown() throws Exception {
+    @AfterEach
+    void tearDown() throws Exception {
         closeTestHarness();
     }
 
@@ -101,7 +97,7 @@ public class TwoPhaseCommitSinkFunctionTest {
      * completes first. See FLINK-10377 and FLINK-14979 for more details.
      */
     @Test
-    public void testSubsumedNotificationOfPreviousCheckpoint() throws Exception {
+    void testSubsumedNotificationOfPreviousCheckpoint() throws Exception {
         harness.open();
         harness.processElement("42", 0);
         harness.snapshot(0, 1);
@@ -113,11 +109,11 @@ public class TwoPhaseCommitSinkFunctionTest {
         harness.notifyOfCompletedCheckpoint(1);
 
         assertExactlyOnce(Arrays.asList("42", "43", "44"));
-        assertEquals(1, tmpDirectory.listFiles().size()); // one for currentTransaction
+        assertThat(tmpDirectory.listFiles()).hasSize(1); // one for currentTransaction
     }
 
     @Test
-    public void testNoTransactionAfterSinkFunctionFinish() throws Exception {
+    void testNoTransactionAfterSinkFunctionFinish() throws Exception {
         harness.open();
         harness.processElement("42", 0);
         harness.snapshot(0, 1);
@@ -134,23 +130,18 @@ public class TwoPhaseCommitSinkFunctionTest {
         // make sure the previous empty transaction will not be pre-committed
         harness.snapshot(3, 6);
 
-        try {
-            harness.processElement("45", 7);
-            fail(
-                    "TwoPhaseCommitSinkFunctionTest should not process any more input data after finish!");
-        } catch (NullPointerException e) {
-            // expected and do nothing here
-        }
+        assertThatThrownBy(() -> harness.processElement("45", 7))
+                .isInstanceOf(NullPointerException.class);
 
         // Checkpoint2 has not complete
         assertExactlyOnce(Arrays.asList("42", "43"));
 
         // transaction for checkpoint2
-        assertEquals(1, tmpDirectory.listFiles().size());
+        assertThat(tmpDirectory.listFiles()).hasSize(1);
     }
 
     @Test
-    public void testRecoverFromStateAfterFinished() throws Exception {
+    void testRecoverFromStateAfterFinished() throws Exception {
         harness.open();
         harness.processElement("42", 0);
         sinkFunction.finish();
@@ -162,11 +153,11 @@ public class TwoPhaseCommitSinkFunctionTest {
 
         harness.initializeState(operatorSubtaskState);
         harness.open();
-        assertEquals(0, sinkFunction.abortedTransactions.size());
+        assertThat(sinkFunction.abortedTransactions).isEmpty();
     }
 
     @Test
-    public void testNotifyOfCompletedCheckpoint() throws Exception {
+    void testNotifyOfCompletedCheckpoint() throws Exception {
         harness.open();
         harness.processElement("42", 0);
         harness.snapshot(0, 1);
@@ -177,15 +168,12 @@ public class TwoPhaseCommitSinkFunctionTest {
         harness.notifyOfCompletedCheckpoint(1);
 
         assertExactlyOnce(Arrays.asList("42", "43"));
-        assertEquals(
-                2,
-                tmpDirectory
-                        .listFiles()
-                        .size()); // one for checkpointId 2 and second for the currentTransaction
+        // one for checkpointId 2 and second for the currentTransaction
+        assertThat(tmpDirectory.listFiles()).hasSize(2);
     }
 
     @Test
-    public void testFailBeforeNotify() throws Exception {
+    void testFailBeforeNotify() throws Exception {
         harness.open();
         harness.processElement("42", 0);
         harness.snapshot(0, 1);
@@ -193,16 +181,14 @@ public class TwoPhaseCommitSinkFunctionTest {
         OperatorSubtaskState snapshot = harness.snapshot(1, 3);
 
         tmpDirectory.setWritable(false);
-        try {
-            harness.processElement("44", 4);
-            harness.snapshot(2, 5);
-            fail("something should fail");
-        } catch (Exception ex) {
-            if (!(ex.getCause() instanceof ContentDump.NotWritableException)) {
-                throw ex;
-            }
-            // ignore
-        }
+
+        assertThatThrownBy(
+                        () -> {
+                            harness.processElement("44", 4);
+                            harness.snapshot(2, 5);
+                        })
+                .hasCauseInstanceOf(ContentDump.NotWritableException.class);
+
         closeTestHarness();
 
         tmpDirectory.setWritable(true);
@@ -213,11 +199,11 @@ public class TwoPhaseCommitSinkFunctionTest {
         assertExactlyOnce(Arrays.asList("42", "43"));
         closeTestHarness();
 
-        assertEquals(0, tmpDirectory.listFiles().size());
+        assertThat(tmpDirectory.listFiles()).isEmpty();
     }
 
     @Test
-    public void testIgnoreCommitExceptionDuringRecovery() throws Exception {
+    void testIgnoreCommitExceptionDuringRecovery() throws Exception {
         clock.setEpochMilli(0);
 
         harness.open();
@@ -235,12 +221,9 @@ public class TwoPhaseCommitSinkFunctionTest {
         sinkFunction.setTransactionTimeout(transactionTimeout);
         sinkFunction.ignoreFailuresAfterTransactionTimeout();
 
-        try {
-            harness.initializeState(snapshot);
-            fail("Expected exception not thrown");
-        } catch (RuntimeException e) {
-            assertEquals("Expected exception", e.getMessage());
-        }
+        assertThatThrownBy(() -> harness.initializeState(snapshot))
+                .isInstanceOf(RuntimeException.class)
+                .hasMessage("Expected exception");
 
         clock.setEpochMilli(transactionTimeout + 1);
         harness.initializeState(snapshot);
@@ -249,7 +232,7 @@ public class TwoPhaseCommitSinkFunctionTest {
     }
 
     @Test
-    public void testLogTimeoutAlmostReachedWarningDuringCommit() throws Exception {
+    void testLogTimeoutAlmostReachedWarningDuringCommit() throws Exception {
         clock.setEpochMilli(0);
 
         final long transactionTimeout = 1000;
@@ -263,16 +246,15 @@ public class TwoPhaseCommitSinkFunctionTest {
         clock.setEpochMilli(elapsedTime);
         harness.notifyOfCompletedCheckpoint(1);
 
-        assertThat(
-                testLoggerResource.getMessages(),
-                hasItem(
-                        containsString(
-                                "has been open for 502 ms. "
-                                        + "This is close to or even exceeding the transaction timeout of 1000 ms.")));
+        assertThat(testLoggerResource.getMessages())
+                .anyMatch(
+                        item ->
+                                item.contains(
+                                        "has been open for 502 ms. This is close to or even exceeding the transaction timeout of 1000 ms."));
     }
 
     @Test
-    public void testLogTimeoutAlmostReachedWarningDuringRecovery() throws Exception {
+    void testLogTimeoutAlmostReachedWarningDuringRecovery() throws Exception {
         clock.setEpochMilli(0);
 
         final long transactionTimeout = 1000;
@@ -296,22 +278,21 @@ public class TwoPhaseCommitSinkFunctionTest {
 
         closeTestHarness();
 
-        assertThat(
-                testLoggerResource.getMessages(),
-                hasItem(
-                        containsString(
-                                "has been open for 502 ms. "
-                                        + "This is close to or even exceeding the transaction timeout of 1000 ms.")));
+        assertThat(testLoggerResource.getMessages())
+                .anyMatch(
+                        item ->
+                                item.contains(
+                                        "has been open for 502 ms. This is close to or even exceeding the transaction timeout of 1000 ms."));
     }
 
-    private void assertExactlyOnce(List<String> expectedValues) throws IOException {
+    private void assertExactlyOnce(List<String> expectedValues) {
         ArrayList<String> actualValues = new ArrayList<>();
         for (String name : targetDirectory.listFiles()) {
             actualValues.addAll(targetDirectory.read(name));
         }
         Collections.sort(actualValues);
         Collections.sort(expectedValues);
-        assertEquals(expectedValues, actualValues);
+        assertThat(actualValues).isEqualTo(expectedValues);
     }
 
     private class ContentDumpSinkFunction
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/filesystem/BucketAssignerTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/filesystem/BucketAssignerTest.java
index 31ddb8cdabe..4c0930d5899 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/filesystem/BucketAssignerTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/filesystem/BucketAssignerTest.java
@@ -24,22 +24,23 @@ import org.apache.flink.core.fs.FileSystem;
 import org.apache.flink.core.fs.Path;
 import org.apache.flink.streaming.api.functions.sink.filesystem.bucketassigners.BasePathBucketAssigner;
 import org.apache.flink.streaming.api.functions.sink.filesystem.rollingpolicies.DefaultRollingPolicy;
+import org.apache.flink.testutils.junit.utils.TempDirUtils;
 
-import org.junit.Assert;
-import org.junit.ClassRule;
-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 static org.assertj.core.api.Assertions.assertThat;
+
 /** Integration tests for {@link BucketAssigner bucket assigners}. */
-public class BucketAssignerTest {
+class BucketAssignerTest {
 
-    @ClassRule public static final TemporaryFolder TEMP_FOLDER = new TemporaryFolder();
+    @TempDir private static java.nio.file.Path tempDir;
 
     @Test
-    public void testAssembleBucketPath() throws Exception {
-        final File outDir = TEMP_FOLDER.newFolder();
+    void testAssembleBucketPath() throws Exception {
+        final File outDir = TempDirUtils.newFolder(tempDir);
         final Path basePath = new Path(outDir.toURI());
         final long time = 1000L;
 
@@ -60,6 +61,6 @@ public class BucketAssignerTest {
 
         Bucket<String, String> bucket =
                 buckets.onElement("abc", new TestUtils.MockSinkContext(time, time, time));
-        Assert.assertEquals(new Path(basePath.toUri()), bucket.getBucketPath());
+        assertThat(bucket.getBucketPath()).isEqualTo(new Path(basePath.toUri()));
     }
 }
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/filesystem/BucketStateSerializerTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/filesystem/BucketStateSerializerTest.java
index c456ba7af32..e15b92a5da7 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/filesystem/BucketStateSerializerTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/filesystem/BucketStateSerializerTest.java
@@ -26,15 +26,14 @@ import org.apache.flink.core.io.SimpleVersionedSerialization;
 import org.apache.flink.core.io.SimpleVersionedSerializer;
 import org.apache.flink.streaming.api.functions.sink.filesystem.bucketassigners.SimpleVersionedStringSerializer;
 import org.apache.flink.streaming.api.functions.sink.filesystem.rollingpolicies.DefaultRollingPolicy;
+import org.apache.flink.testutils.junit.extensions.parameterized.Parameter;
+import org.apache.flink.testutils.junit.extensions.parameterized.ParameterizedTestExtension;
+import org.apache.flink.testutils.junit.extensions.parameterized.Parameters;
 import org.apache.flink.util.FileUtils;
 
-import org.junit.Assert;
-import org.junit.ClassRule;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.TestTemplate;
+import org.junit.jupiter.api.extension.ExtendWith;
 
 import java.io.IOException;
 import java.nio.file.Files;
@@ -46,12 +45,7 @@ import java.util.Map;
 import java.util.Set;
 import java.util.stream.Collectors;
 
-import static org.hamcrest.CoreMatchers.hasItem;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.startsWith;
-import static org.hamcrest.Matchers.empty;
-import static org.hamcrest.Matchers.iterableWithSize;
-import static org.junit.Assert.assertThat;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /**
  * Tests for the {@link BucketStateSerializer} that verify we can still read snapshots written using
@@ -59,17 +53,17 @@ import static org.junit.Assert.assertThat;
  * control (including the current version). The tests verify that the current version of the
  * serializer can still read data from all previous versions.
  */
-@RunWith(Parameterized.class)
-public class BucketStateSerializerTest {
+@ExtendWith(ParameterizedTestExtension.class)
+class BucketStateSerializerTest {
 
     private static final int CURRENT_VERSION = 2;
 
-    @Parameterized.Parameters(name = "Previous Version = {0}")
-    public static Collection<Integer> previousVersions() {
+    @Parameters(name = "Previous Version = {0}")
+    private static Collection<Integer> previousVersions() {
         return Arrays.asList(1, 2);
     }
 
-    @Parameterized.Parameter public Integer previousVersion;
+    @Parameter private Integer previousVersion;
 
     private static final String IN_PROGRESS_CONTENT = "writing";
     private static final String PENDING_CONTENT = "wrote";
@@ -79,20 +73,18 @@ public class BucketStateSerializerTest {
     private static final java.nio.file.Path BASE_PATH =
             Paths.get("src/test/resources/").resolve("bucket-state-migration-test");
 
-    @ClassRule public static TemporaryFolder tempFolder = new TemporaryFolder();
-
     private final BucketStateGenerator generator =
             new BucketStateGenerator(
                     BUCKET_ID, IN_PROGRESS_CONTENT, PENDING_CONTENT, BASE_PATH, CURRENT_VERSION);
 
-    @Test
-    @Ignore
-    public void prepareDeserializationEmpty() throws IOException {
+    @TestTemplate
+    @Disabled
+    void prepareDeserializationEmpty() throws IOException {
         generator.prepareDeserializationEmpty();
     }
 
-    @Test
-    public void testSerializationEmpty() throws IOException {
+    @TestTemplate
+    void testSerializationEmpty() throws IOException {
 
         final String scenarioName = "empty";
         final BucketStatePathResolver pathResolver =
@@ -104,19 +96,19 @@ public class BucketStateSerializerTest {
 
         final Bucket<String, String> bucket = restoreBucket(0, recoveredState);
 
-        Assert.assertEquals(testBucketPath, bucket.getBucketPath());
-        Assert.assertNull(bucket.getInProgressPart());
-        Assert.assertTrue(bucket.getPendingFileRecoverablesPerCheckpoint().isEmpty());
+        assertThat(bucket.getBucketPath()).isEqualTo(testBucketPath);
+        assertThat(bucket.getInProgressPart()).isNull();
+        assertThat(bucket.getPendingFileRecoverablesPerCheckpoint()).isEmpty();
     }
 
-    @Test
-    @Ignore
-    public void prepareDeserializationOnlyInProgress() throws IOException {
+    @TestTemplate
+    @Disabled
+    void prepareDeserializationOnlyInProgress() throws IOException {
         generator.prepareDeserializationOnlyInProgress();
     }
 
-    @Test
-    public void testSerializationOnlyInProgress() throws IOException {
+    @TestTemplate
+    void testSerializationOnlyInProgress() throws IOException {
 
         final String scenarioName = "only-in-progress";
         final BucketStatePathResolver pathResolver =
@@ -130,44 +122,43 @@ public class BucketStateSerializerTest {
 
         final Bucket<String, String> bucket = restoreBucket(0, recoveredState);
 
-        Assert.assertEquals(testBucketPath, bucket.getBucketPath());
+        assertThat(bucket.getBucketPath()).isEqualTo(testBucketPath);
 
         // check restore the correct in progress file writer
-        Assert.assertEquals(8, bucket.getInProgressPart().getSize());
+        assertThat(bucket.getInProgressPart().getSize()).isEqualTo(8);
 
         long numFiles =
                 Files.list(Paths.get(testBucketPath.toString()))
                         .map(
                                 file -> {
-                                    assertThat(
-                                            file.getFileName().toString(),
-                                            startsWith(".part-0-0.inprogress"));
+                                    assertThat(file.getFileName().toString())
+                                            .startsWith(".part-0-0.inprogress");
                                     return 1;
                                 })
                         .count();
 
-        assertThat(numFiles, is(1L));
+        assertThat(numFiles).isOne();
     }
 
-    @Test
-    @Ignore
-    public void prepareDeserializationFull() throws IOException {
+    @TestTemplate
+    @Disabled
+    void prepareDeserializationFull() throws IOException {
         generator.prepareDeserializationFull();
     }
 
-    @Test
-    public void testSerializationFull() throws IOException {
+    @TestTemplate
+    void testSerializationFull() throws IOException {
         testDeserializationFull(true, "full");
     }
 
-    @Test
-    @Ignore
+    @TestTemplate
+    @Disabled
     public void prepareDeserializationNullInProgress() throws IOException {
         generator.prepareDeserializationNullInProgress();
     }
 
-    @Test
-    public void testSerializationNullInProgress() throws IOException {
+    @TestTemplate
+    void testSerializationNullInProgress() throws IOException {
         testDeserializationFull(false, "full-no-in-progress");
     }
 
@@ -189,7 +180,7 @@ public class BucketStateSerializerTest {
             final Map<Long, List<InProgressFileWriter.PendingFileRecoverable>>
                     pendingFileRecoverables =
                             recoveredState.getPendingFileRecoverablesPerCheckpoint();
-            Assert.assertEquals(5L, pendingFileRecoverables.size());
+            assertThat(pendingFileRecoverables).hasSize(5);
 
             final Set<String> beforeRestorePaths =
                     Files.list(outputPath.resolve(BUCKET_ID))
@@ -199,13 +190,13 @@ public class BucketStateSerializerTest {
             // before retsoring all file has "inprogress"
             for (int i = 0; i < noOfPendingCheckpoints; i++) {
                 final String part = ".part-0-" + i + ".inprogress";
-                assertThat(beforeRestorePaths, hasItem(startsWith(part)));
+                assertThat(beforeRestorePaths).anyMatch(item -> item.startsWith(part));
             }
 
             // recover and commit
             final Bucket bucket = restoreBucket(noOfPendingCheckpoints + 1, recoveredState);
-            Assert.assertEquals(testBucketPath, bucket.getBucketPath());
-            Assert.assertEquals(0, bucket.getPendingFileRecoverablesForCurrentCheckpoint().size());
+            assertThat(bucket.getBucketPath()).isEqualTo(testBucketPath);
+            assertThat(bucket.getPendingFileRecoverablesForCurrentCheckpoint()).isEmpty();
 
             final Set<String> afterRestorePaths =
                     Files.list(outputPath.resolve(BUCKET_ID))
@@ -216,20 +207,24 @@ public class BucketStateSerializerTest {
             // there is no "inporgress" in file name for the committed files.
             for (int i = 0; i < noOfPendingCheckpoints; i++) {
                 final String part = "part-0-" + i;
-                assertThat(afterRestorePaths, hasItem(part));
+                assertThat(afterRestorePaths).contains(part);
                 afterRestorePaths.remove(part);
             }
 
             if (withInProgress) {
                 // only the in-progress must be left
-                assertThat(afterRestorePaths, iterableWithSize(1));
+                assertThat(afterRestorePaths).hasSize(1);
 
                 // verify that the in-progress file is still there
-                assertThat(
-                        afterRestorePaths,
-                        hasItem(startsWith(".part-0-" + noOfPendingCheckpoints + ".inprogress")));
+                assertThat(afterRestorePaths)
+                        .anyMatch(
+                                item ->
+                                        item.startsWith(
+                                                ".part-0-"
+                                                        + noOfPendingCheckpoints
+                                                        + ".inprogress"));
             } else {
-                assertThat(afterRestorePaths, empty());
+                assertThat(afterRestorePaths).isEmpty();
             }
         } finally {
             FileUtils.deleteDirectory(pathResolver.getResourcePath(scenarioName).toFile());
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/filesystem/BucketTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/filesystem/BucketTest.java
index 245e895878b..372cfca3685 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/filesystem/BucketTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/filesystem/BucketTest.java
@@ -31,13 +31,12 @@ import org.apache.flink.streaming.api.functions.sink.filesystem.utils.NoOpCommit
 import org.apache.flink.streaming.api.functions.sink.filesystem.utils.NoOpRecoverable;
 import org.apache.flink.streaming.api.functions.sink.filesystem.utils.NoOpRecoverableFsDataOutputStream;
 import org.apache.flink.streaming.api.functions.sink.filesystem.utils.NoOpRecoverableWriter;
+import org.apache.flink.testutils.junit.utils.TempDirUtils;
 
 import org.hamcrest.Description;
 import org.hamcrest.TypeSafeMatcher;
-import org.junit.Assert;
-import org.junit.ClassRule;
-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.io.IOException;
@@ -47,17 +46,17 @@ import java.util.List;
 import java.util.Map;
 
 import static org.apache.flink.util.Preconditions.checkArgument;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.HamcrestCondition.matching;
 
 /** Tests for the {@code Bucket}. */
-public class BucketTest {
+class BucketTest {
 
-    @ClassRule public static final TemporaryFolder TEMP_FOLDER = new TemporaryFolder();
+    @TempDir private static java.nio.file.Path tempFolder;
 
     @Test
-    public void shouldNotCleanupResumablesThatArePartOfTheAckedCheckpoint() throws IOException {
-        final File outDir = TEMP_FOLDER.newFolder();
+    void shouldNotCleanupResumablesThatArePartOfTheAckedCheckpoint() throws IOException {
+        final File outDir = TempDirUtils.newFolder(tempFolder);
         final Path path = new Path(outDir.toURI());
 
         final TestRecoverableWriter recoverableWriter = getRecoverableWriter(path);
@@ -67,17 +66,16 @@ public class BucketTest {
         bucketUnderTest.write("test-element", 0L);
 
         final BucketState<String> state = bucketUnderTest.onReceptionOfCheckpoint(0L);
-        assertThat(state, hasActiveInProgressFile());
+        assertThat(state).is(matching(hasActiveInProgressFile()));
 
         bucketUnderTest.onSuccessfulCompletionOfCheckpoint(0L);
-        assertThat(
-                recoverableWriter,
-                hasCalledDiscard(0)); // it did not discard as this is still valid.
+        assertThat(recoverableWriter)
+                .is(matching(hasCalledDiscard(0))); // it did not discard as this is still valid.
     }
 
     @Test
-    public void shouldCleanupOutdatedResumablesOnCheckpointAck() throws IOException {
-        final File outDir = TEMP_FOLDER.newFolder();
+    void shouldCleanupOutdatedResumablesOnCheckpointAck() throws IOException {
+        final File outDir = TempDirUtils.newFolder(tempFolder);
         final Path path = new Path(outDir.toURI());
 
         final TestRecoverableWriter recoverableWriter = getRecoverableWriter(path);
@@ -87,7 +85,7 @@ public class BucketTest {
         bucketUnderTest.write("test-element", 0L);
 
         final BucketState<String> state = bucketUnderTest.onReceptionOfCheckpoint(0L);
-        assertThat(state, hasActiveInProgressFile());
+        assertThat(state).is(matching(hasActiveInProgressFile()));
 
         bucketUnderTest.onSuccessfulCompletionOfCheckpoint(0L);
 
@@ -95,12 +93,13 @@ public class BucketTest {
         bucketUnderTest.onReceptionOfCheckpoint(2L);
 
         bucketUnderTest.onSuccessfulCompletionOfCheckpoint(2L);
-        assertThat(recoverableWriter, hasCalledDiscard(2)); // that is for checkpoints 0 and 1
+        assertThat(recoverableWriter)
+                .is(matching(hasCalledDiscard(2))); // that is for checkpoints 0 and 1
     }
 
     @Test
-    public void shouldNotCallCleanupWithoutInProgressPartFiles() throws Exception {
-        final File outDir = TEMP_FOLDER.newFolder();
+    void shouldNotCallCleanupWithoutInProgressPartFiles() throws Exception {
+        final File outDir = TempDirUtils.newFolder(tempFolder);
         final Path path = new Path(outDir.toURI());
 
         final TestRecoverableWriter recoverableWriter = getRecoverableWriter(path);
@@ -108,18 +107,19 @@ public class BucketTest {
                 createBucket(recoverableWriter, path, 0, 0, OutputFileConfig.builder().build());
 
         final BucketState<String> state = bucketUnderTest.onReceptionOfCheckpoint(0L);
-        assertThat(state, hasNoActiveInProgressFile());
+        assertThat(state).is(matching(hasNoActiveInProgressFile()));
 
         bucketUnderTest.onReceptionOfCheckpoint(1L);
         bucketUnderTest.onReceptionOfCheckpoint(2L);
 
         bucketUnderTest.onSuccessfulCompletionOfCheckpoint(2L);
-        assertThat(recoverableWriter, hasCalledDiscard(0)); // we have no in-progress file.
+        assertThat(recoverableWriter)
+                .is(matching(hasCalledDiscard(0))); // we have no in-progress file.
     }
 
     @Test
-    public void shouldCleanupOutdatedResumablesAfterResumed() throws Exception {
-        final File outDir = TEMP_FOLDER.newFolder();
+    void shouldCleanupOutdatedResumablesAfterResumed() throws Exception {
+        final File outDir = TempDirUtils.newFolder(tempFolder);
         final Path path = new Path(outDir.toURI());
 
         final TestRecoverableWriter recoverableWriter = getRecoverableWriter(path);
@@ -128,55 +128,55 @@ public class BucketTest {
 
         bucketUnderTest.write("test-element", 0L);
         final BucketState<String> state0 = bucketUnderTest.onReceptionOfCheckpoint(0L);
-        assertThat(state0, hasActiveInProgressFile());
+        assertThat(state0).is(matching(hasActiveInProgressFile()));
         bucketUnderTest.onSuccessfulCompletionOfCheckpoint(0L);
-        assertThat(recoverableWriter, hasCalledDiscard(0));
+        assertThat(recoverableWriter).is(matching(hasCalledDiscard(0)));
 
-        final File newOutDir = TEMP_FOLDER.newFolder();
+        final File newOutDir = TempDirUtils.newFolder(tempFolder);
         final Path newPath = new Path(newOutDir.toURI());
         final TestRecoverableWriter newRecoverableWriter = getRecoverableWriter(newPath);
         final Bucket<String, String> bucketAfterResume =
                 restoreBucket(
                         newRecoverableWriter, 0, 0, state0, OutputFileConfig.builder().build());
         final BucketState<String> state1 = bucketAfterResume.onReceptionOfCheckpoint(1L);
-        assertThat(state1, hasActiveInProgressFile());
+        assertThat(state1).is(matching(hasActiveInProgressFile()));
         bucketAfterResume.onSuccessfulCompletionOfCheckpoint(1L);
-        assertThat(newRecoverableWriter, hasCalledDiscard(1));
+        assertThat(newRecoverableWriter).is(matching(hasCalledDiscard(1)));
     }
 
     // --------------------------- Checking Restore ---------------------------
 
     @Test
-    public void inProgressFileShouldBeCommittedIfWriterDoesNotSupportResume() throws IOException {
+    void inProgressFileShouldBeCommittedIfWriterDoesNotSupportResume() throws IOException {
         final StubNonResumableWriter nonResumableWriter = new StubNonResumableWriter();
         final Bucket<String, String> bucket =
                 getRestoredBucketWithOnlyInProgressPart(nonResumableWriter);
 
-        Assert.assertThat(nonResumableWriter, hasMethodCallCountersEqualTo(1, 0, 1));
-        Assert.assertThat(bucket, hasNullInProgressFile(true));
+        assertThat(nonResumableWriter).is(matching(hasMethodCallCountersEqualTo(1, 0, 1)));
+        assertThat(bucket).is(matching(hasNullInProgressFile(true)));
     }
 
     @Test
-    public void inProgressFileShouldBeRestoredIfWriterSupportsResume() throws IOException {
+    void inProgressFileShouldBeRestoredIfWriterSupportsResume() throws IOException {
         final StubResumableWriter resumableWriter = new StubResumableWriter();
         final Bucket<String, String> bucket =
                 getRestoredBucketWithOnlyInProgressPart(resumableWriter);
 
-        Assert.assertThat(resumableWriter, hasMethodCallCountersEqualTo(1, 1, 0));
-        Assert.assertThat(bucket, hasNullInProgressFile(false));
+        assertThat(resumableWriter).is(matching(hasMethodCallCountersEqualTo(1, 1, 0)));
+        assertThat(bucket).is(matching(hasNullInProgressFile(false)));
     }
 
     @Test
-    public void pendingFilesShouldBeRestored() throws IOException {
+    void pendingFilesShouldBeRestored() throws IOException {
         final int expectedRecoverForCommitCounter = 10;
 
         final StubNonResumableWriter writer = new StubNonResumableWriter();
         final Bucket<String, String> bucket =
                 getRestoredBucketWithOnlyPendingParts(writer, expectedRecoverForCommitCounter);
 
-        Assert.assertThat(
-                writer, hasMethodCallCountersEqualTo(0, 0, expectedRecoverForCommitCounter));
-        Assert.assertThat(bucket, hasNullInProgressFile(true));
+        assertThat(writer)
+                .is(matching(hasMethodCallCountersEqualTo(0, 0, expectedRecoverForCommitCounter)));
+        assertThat(bucket).is(matching(hasNullInProgressFile(true)));
     }
 
     // ------------------------------- Matchers --------------------------------
@@ -432,21 +432,12 @@ public class BucketTest {
                 outputFileConfig);
     }
 
-    private static TestRecoverableWriter getRecoverableWriter(Path path) {
-        try {
-            final FileSystem fs = FileSystem.get(path.toUri());
-            if (!(fs instanceof LocalFileSystem)) {
-                fail(
-                        "Expected Local FS but got a "
-                                + fs.getClass().getName()
-                                + " for path: "
-                                + path);
-            }
-            return new TestRecoverableWriter((LocalFileSystem) fs);
-        } catch (IOException e) {
-            fail();
-        }
-        return null;
+    private static TestRecoverableWriter getRecoverableWriter(Path path) throws IOException {
+        final FileSystem fs = FileSystem.get(path.toUri());
+        assertThat(fs)
+                .as("Expected Local FS but got a " + fs.getClass().getName() + " for path: " + path)
+                .isInstanceOf(LocalFileSystem.class);
+        return new TestRecoverableWriter((LocalFileSystem) fs);
     }
 
     private Bucket<String, String> getRestoredBucketWithOnlyInProgressPart(
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/filesystem/BucketsRollingPolicyTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/filesystem/BucketsRollingPolicyTest.java
index 8eefba09a60..6e3765f9dc9 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/filesystem/BucketsRollingPolicyTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/filesystem/BucketsRollingPolicyTest.java
@@ -24,25 +24,26 @@ import org.apache.flink.core.fs.FileSystem;
 import org.apache.flink.core.fs.Path;
 import org.apache.flink.streaming.api.functions.sink.filesystem.rollingpolicies.DefaultRollingPolicy;
 import org.apache.flink.streaming.api.functions.sink.filesystem.rollingpolicies.OnCheckpointRollingPolicy;
+import org.apache.flink.testutils.junit.utils.TempDirUtils;
 import org.apache.flink.util.Preconditions;
 
-import org.junit.Assert;
-import org.junit.ClassRule;
-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.io.IOException;
 import java.time.Duration;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 /** Tests for different {@link RollingPolicy rolling policies}. */
-public class BucketsRollingPolicyTest {
+class BucketsRollingPolicyTest {
 
-    @ClassRule public static final TemporaryFolder TEMP_FOLDER = new TemporaryFolder();
+    @TempDir private static java.nio.file.Path tempDir;
 
     @Test
-    public void testDefaultRollingPolicy() throws Exception {
-        final File outDir = TEMP_FOLDER.newFolder();
+    void testDefaultRollingPolicy() throws Exception {
+        final File outDir = TempDirUtils.newFolder(tempDir);
         final Path path = new Path(outDir.toURI());
 
         final RollingPolicy<String, String> originalRollingPolicy =
@@ -87,7 +88,7 @@ public class BucketsRollingPolicyTest {
     }
 
     @Test
-    public void testDefaultRollingPolicyDeprecatedCreate() throws Exception {
+    void testDefaultRollingPolicyDeprecatedCreate() {
         DefaultRollingPolicy policy =
                 DefaultRollingPolicy.builder()
                         .withInactivityInterval(Duration.ofMillis(10))
@@ -95,14 +96,14 @@ public class BucketsRollingPolicyTest {
                         .withRolloverInterval(Duration.ofMillis(30))
                         .build();
 
-        Assert.assertEquals(10, policy.getInactivityInterval());
-        Assert.assertEquals(20, policy.getMaxPartSize());
-        Assert.assertEquals(30, policy.getRolloverInterval());
+        assertThat(policy.getInactivityInterval()).isEqualTo(10);
+        assertThat(policy.getMaxPartSize()).isEqualTo(20);
+        assertThat(policy.getRolloverInterval()).isEqualTo(30);
     }
 
     @Test
-    public void testRollOnCheckpointPolicy() throws Exception {
-        final File outDir = TEMP_FOLDER.newFolder();
+    void testRollOnCheckpointPolicy() throws Exception {
+        final File outDir = TempDirUtils.newFolder(tempDir);
         final Path path = new Path(outDir.toURI());
 
         final MethodCallCountingPolicyWrapper<String, String> rollingPolicy =
@@ -131,8 +132,8 @@ public class BucketsRollingPolicyTest {
     }
 
     @Test
-    public void testCustomRollingPolicy() throws Exception {
-        final File outDir = TEMP_FOLDER.newFolder();
+    void testCustomRollingPolicy() throws Exception {
+        final File outDir = TempDirUtils.newFolder(tempDir);
         final Path path = new Path(outDir.toURI());
 
         final MethodCallCountingPolicyWrapper<String, String> rollingPolicy =
@@ -289,12 +290,12 @@ public class BucketsRollingPolicyTest {
                 final long onEventRolls,
                 final long onProcessingTimeCalls,
                 final long onProcessingTimeRolls) {
-            Assert.assertEquals(onCheckpointCalls, onCheckpointCallCounter);
-            Assert.assertEquals(onCheckpointRolls, onCheckpointRollCounter);
-            Assert.assertEquals(onEventCalls, onEventCallCounter);
-            Assert.assertEquals(onEventRolls, onEventRollCounter);
-            Assert.assertEquals(onProcessingTimeCalls, onProcessingTimeCallCounter);
-            Assert.assertEquals(onProcessingTimeRolls, onProcessingTimeRollCounter);
+            assertThat(onCheckpointCallCounter).isEqualTo(onCheckpointCalls);
+            assertThat(onCheckpointRollCounter).isEqualTo(onCheckpointRolls);
+            assertThat(onEventCallCounter).isEqualTo(onEventCalls);
+            assertThat(onEventRollCounter).isEqualTo(onEventRolls);
+            assertThat(onProcessingTimeCallCounter).isEqualTo(onProcessingTimeCalls);
+            assertThat(onProcessingTimeRollCounter).isEqualTo(onProcessingTimeRolls);
         }
     }
 }
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/filesystem/BucketsTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/filesystem/BucketsTest.java
index 98dd89abede..30e14518b59 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/filesystem/BucketsTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/filesystem/BucketsTest.java
@@ -29,34 +29,32 @@ import org.apache.flink.streaming.api.functions.sink.filesystem.TestUtils.MockLi
 import org.apache.flink.streaming.api.functions.sink.filesystem.bucketassigners.SimpleVersionedStringSerializer;
 import org.apache.flink.streaming.api.functions.sink.filesystem.rollingpolicies.DefaultRollingPolicy;
 import org.apache.flink.streaming.api.functions.sink.filesystem.rollingpolicies.OnCheckpointRollingPolicy;
+import org.apache.flink.testutils.junit.utils.TempDirUtils;
 
 import org.hamcrest.Description;
 import org.hamcrest.TypeSafeMatcher;
-import org.junit.Assert;
-import org.junit.ClassRule;
-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.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 
-import static org.hamcrest.MatcherAssert.assertThat;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.HamcrestCondition.matching;
 
 /** Tests for {@link Buckets}. */
-public class BucketsTest {
+class BucketsTest {
 
-    @ClassRule public static final TemporaryFolder TEMP_FOLDER = new TemporaryFolder();
+    @TempDir private static java.nio.file.Path tempFolder;
 
     @Test
-    public void testSnapshotAndRestore() throws Exception {
-        final File outDir = TEMP_FOLDER.newFolder();
+    void testSnapshotAndRestore() throws Exception {
+        final File outDir = TempDirUtils.newFolder(tempFolder);
         final Path path = new Path(outDir.toURI());
 
         final RollingPolicy<String, String> onCheckpointRollingPolicy =
@@ -70,19 +68,16 @@ public class BucketsTest {
         buckets.onElement("test1", new TestUtils.MockSinkContext(null, 1L, 2L));
         buckets.snapshotState(0L, bucketStateContainer, partCounterContainer);
 
-        assertThat(
-                buckets.getActiveBuckets().get("test1"),
-                hasSinglePartFileToBeCommittedOnCheckpointAck(path, "test1"));
+        assertThat(buckets.getActiveBuckets().get("test1"))
+                .is(matching(hasSinglePartFileToBeCommittedOnCheckpointAck(path, "test1")));
 
         buckets.onElement("test2", new TestUtils.MockSinkContext(null, 1L, 2L));
         buckets.snapshotState(1L, bucketStateContainer, partCounterContainer);
 
-        assertThat(
-                buckets.getActiveBuckets().get("test1"),
-                hasSinglePartFileToBeCommittedOnCheckpointAck(path, "test1"));
-        assertThat(
-                buckets.getActiveBuckets().get("test2"),
-                hasSinglePartFileToBeCommittedOnCheckpointAck(path, "test2"));
+        assertThat(buckets.getActiveBuckets().get("test1"))
+                .is(matching(hasSinglePartFileToBeCommittedOnCheckpointAck(path, "test1")));
+        assertThat(buckets.getActiveBuckets().get("test2"))
+                .is(matching(hasSinglePartFileToBeCommittedOnCheckpointAck(path, "test2")));
 
         Buckets<String, String> restoredBuckets =
                 restoreBuckets(
@@ -96,7 +91,7 @@ public class BucketsTest {
                 restoredBuckets.getActiveBuckets();
 
         // because we commit pending files for previous checkpoints upon recovery
-        Assert.assertTrue(activeBuckets.isEmpty());
+        assertThat(activeBuckets).isEmpty();
     }
 
     private static TypeSafeMatcher<Bucket<String, String>>
@@ -123,8 +118,8 @@ public class BucketsTest {
     }
 
     @Test
-    public void testMergeAtScaleInAndMaxCounterAtRecovery() throws Exception {
-        final File outDir = TEMP_FOLDER.newFolder();
+    void testMergeAtScaleInAndMaxCounterAtRecovery() throws Exception {
+        final File outDir = TempDirUtils.newFolder(tempFolder);
         final Path path = new Path(outDir.toURI());
 
         final RollingPolicy<String, String> onCheckpointRP =
@@ -144,10 +139,10 @@ public class BucketsTest {
         bucketsOne.onElement("test1", new TestUtils.MockSinkContext(null, 1L, 2L));
         bucketsOne.snapshotState(0L, bucketStateContainerOne, partCounterContainerOne);
 
-        Assert.assertEquals(1L, bucketsOne.getMaxPartCounter());
+        assertThat(bucketsOne.getMaxPartCounter()).isOne();
 
         // make sure we have one in-progress file here
-        Assert.assertNotNull(bucketsOne.getActiveBuckets().get("test1").getInProgressPart());
+        assertThat(bucketsOne.getActiveBuckets().get("test1").getInProgressPart()).isNotNull();
 
         // add a couple of in-progress files so that the part counter increases.
         bucketsTwo.onElement("test1", new TestUtils.MockSinkContext(null, 1L, 2L));
@@ -157,17 +152,16 @@ public class BucketsTest {
 
         bucketsTwo.snapshotState(0L, bucketStateContainerTwo, partCounterContainerTwo);
 
-        Assert.assertEquals(2L, bucketsTwo.getMaxPartCounter());
+        assertThat(bucketsTwo.getMaxPartCounter()).isEqualTo(2L);
 
         // make sure we have one in-progress file here and a pending
-        Assert.assertEquals(
-                1L,
-                bucketsTwo
-                        .getActiveBuckets()
-                        .get("test1")
-                        .getPendingFileRecoverablesPerCheckpoint()
-                        .size());
-        Assert.assertNotNull(bucketsTwo.getActiveBuckets().get("test1").getInProgressPart());
+        assertThat(
+                        bucketsTwo
+                                .getActiveBuckets()
+                                .get("test1")
+                                .getPendingFileRecoverablesPerCheckpoint())
+                .hasSize(1);
+        assertThat(bucketsTwo.getActiveBuckets().get("test1").getInProgressPart()).isNotNull();
 
         final ListState<byte[]> mergedBucketStateContainer = new MockListState<>();
         final ListState<Long> mergedPartCounterContainer = new MockListState<>();
@@ -187,30 +181,29 @@ public class BucketsTest {
                         mergedPartCounterContainer);
 
         // we get the maximum of the previous tasks
-        Assert.assertEquals(2L, restoredBuckets.getMaxPartCounter());
+        assertThat(restoredBuckets.getMaxPartCounter()).isEqualTo(2L);
 
         final Map<String, Bucket<String, String>> activeBuckets =
                 restoredBuckets.getActiveBuckets();
-        Assert.assertEquals(1L, activeBuckets.size());
-        Assert.assertTrue(activeBuckets.keySet().contains("test1"));
+        assertThat(activeBuckets).hasSize(1).containsKey("test1");
 
         final Bucket<String, String> bucket = activeBuckets.get("test1");
-        Assert.assertEquals("test1", bucket.getBucketId());
-        Assert.assertEquals(new Path(path, "test1"), bucket.getBucketPath());
+        assertThat(bucket.getBucketId()).isEqualTo("test1");
+        assertThat(bucket.getBucketPath()).isEqualTo(new Path(path, "test1"));
 
-        Assert.assertNotNull(bucket.getInProgressPart()); // the restored part file
+        assertThat(bucket.getInProgressPart()).isNotNull(); // the restored part file
 
         // this is due to the Bucket#merge(). The in progress file of one
         // of the previous tasks is put in the list of pending files.
-        Assert.assertEquals(1L, bucket.getPendingFileRecoverablesForCurrentCheckpoint().size());
+        assertThat(bucket.getPendingFileRecoverablesForCurrentCheckpoint()).hasSize(1);
 
         // we commit the pending for previous checkpoints
-        Assert.assertTrue(bucket.getPendingFileRecoverablesPerCheckpoint().isEmpty());
+        assertThat(bucket.getPendingFileRecoverablesPerCheckpoint()).isEmpty();
     }
 
     @Test
-    public void testOnProcessingTime() throws Exception {
-        final File outDir = TEMP_FOLDER.newFolder();
+    void testOnProcessingTime() throws Exception {
+        final File outDir = TempDirUtils.newFolder(tempFolder);
         final Path path = new Path(outDir.toURI());
 
         final OnProcessingTimePolicy<String, String> rollOnProcessingTimeCountingPolicy =
@@ -225,26 +218,24 @@ public class BucketsTest {
 
         // now it should roll
         buckets.onProcessingTime(7L);
-        Assert.assertEquals(
-                1L, rollOnProcessingTimeCountingPolicy.getOnProcessingTimeRollCounter());
+        assertThat(rollOnProcessingTimeCountingPolicy.getOnProcessingTimeRollCounter()).isOne();
 
         final Map<String, Bucket<String, String>> activeBuckets = buckets.getActiveBuckets();
-        Assert.assertEquals(1L, activeBuckets.size());
-        Assert.assertTrue(activeBuckets.keySet().contains("test"));
+        assertThat(activeBuckets).hasSize(1).containsKey("test");
 
         final Bucket<String, String> bucket = activeBuckets.get("test");
-        Assert.assertEquals("test", bucket.getBucketId());
-        Assert.assertEquals(new Path(path, "test"), bucket.getBucketPath());
-        Assert.assertEquals("test", bucket.getBucketId());
+        assertThat(bucket.getBucketId()).isEqualTo("test");
+        assertThat(bucket.getBucketPath()).isEqualTo(new Path(path, "test"));
+        assertThat(bucket.getBucketId()).isEqualTo("test");
 
-        Assert.assertNull(bucket.getInProgressPart());
-        Assert.assertEquals(1L, bucket.getPendingFileRecoverablesForCurrentCheckpoint().size());
-        Assert.assertTrue(bucket.getPendingFileRecoverablesPerCheckpoint().isEmpty());
+        assertThat(bucket.getInProgressPart()).isNull();
+        assertThat(bucket.getPendingFileRecoverablesForCurrentCheckpoint()).hasSize(1);
+        assertThat(bucket.getPendingFileRecoverablesPerCheckpoint()).isEmpty();
     }
 
     @Test
-    public void testBucketIsRemovedWhenNotActive() throws Exception {
-        final File outDir = TEMP_FOLDER.newFolder();
+    void testBucketIsRemovedWhenNotActive() throws Exception {
+        final File outDir = TempDirUtils.newFolder(tempFolder);
         final Path path = new Path(outDir.toURI());
 
         final OnProcessingTimePolicy<String, String> rollOnProcessingTimeCountingPolicy =
@@ -259,18 +250,17 @@ public class BucketsTest {
 
         // now it should roll
         buckets.onProcessingTime(7L);
-        Assert.assertEquals(
-                1L, rollOnProcessingTimeCountingPolicy.getOnProcessingTimeRollCounter());
+        assertThat(rollOnProcessingTimeCountingPolicy.getOnProcessingTimeRollCounter()).isOne();
 
         buckets.snapshotState(0L, new MockListState<>(), new MockListState<>());
         buckets.commitUpToCheckpoint(0L);
 
-        Assert.assertTrue(buckets.getActiveBuckets().isEmpty());
+        assertThat(buckets.getActiveBuckets()).isEmpty();
     }
 
     @Test
-    public void testPartCounterAfterBucketResurrection() throws Exception {
-        final File outDir = TEMP_FOLDER.newFolder();
+    void testPartCounterAfterBucketResurrection() throws Exception {
+        final File outDir = TempDirUtils.newFolder(tempFolder);
         final Path path = new Path(outDir.toURI());
 
         final OnProcessingTimePolicy<String, String> rollOnProcessingTimeCountingPolicy =
@@ -282,21 +272,20 @@ public class BucketsTest {
         // it takes the current processing time of the context for the creation time, and for the
         // last modification time.
         buckets.onElement("test", new TestUtils.MockSinkContext(1L, 2L, 3L));
-        Assert.assertEquals(1L, buckets.getActiveBuckets().get("test").getPartCounter());
+        assertThat(buckets.getActiveBuckets().get("test").getPartCounter()).isOne();
 
         // now it should roll
         buckets.onProcessingTime(7L);
-        Assert.assertEquals(
-                1L, rollOnProcessingTimeCountingPolicy.getOnProcessingTimeRollCounter());
-        Assert.assertEquals(1L, buckets.getActiveBuckets().get("test").getPartCounter());
+        assertThat(rollOnProcessingTimeCountingPolicy.getOnProcessingTimeRollCounter()).isOne();
+        assertThat(buckets.getActiveBuckets().get("test").getPartCounter()).isOne();
 
         buckets.snapshotState(0L, new MockListState<>(), new MockListState<>());
         buckets.commitUpToCheckpoint(0L);
 
-        Assert.assertTrue(buckets.getActiveBuckets().isEmpty());
+        assertThat(buckets.getActiveBuckets()).isEmpty();
 
         buckets.onElement("test", new TestUtils.MockSinkContext(2L, 3L, 4L));
-        Assert.assertEquals(2L, buckets.getActiveBuckets().get("test").getPartCounter());
+        assertThat(buckets.getActiveBuckets().get("test").getPartCounter()).isEqualTo(2L);
     }
 
     private static class OnProcessingTimePolicy<IN, BucketID>
@@ -338,18 +327,18 @@ public class BucketsTest {
     }
 
     @Test
-    public void testContextPassingNormalExecution() throws Exception {
+    void testContextPassingNormalExecution() throws Exception {
         testCorrectTimestampPassingInContext(1L, 2L, 3L);
     }
 
     @Test
-    public void testContextPassingNullTimestamp() throws Exception {
+    void testContextPassingNullTimestamp() throws Exception {
         testCorrectTimestampPassingInContext(null, 2L, 3L);
     }
 
     private void testCorrectTimestampPassingInContext(
             Long timestamp, long watermark, long processingTime) throws Exception {
-        final File outDir = TEMP_FOLDER.newFolder();
+        final File outDir = TempDirUtils.newFolder(tempFolder);
         final Path path = new Path(outDir.toURI());
 
         final Buckets<String, String> buckets =
@@ -391,9 +380,9 @@ public class BucketsTest {
             final long watermark = context.currentWatermark();
             final long processingTime = context.currentProcessingTime();
 
-            Assert.assertEquals(expectedTimestamp, elementTimestamp);
-            Assert.assertEquals(expectedProcessingTime, processingTime);
-            Assert.assertEquals(expectedWatermark, watermark);
+            assertThat(elementTimestamp).isEqualTo(expectedTimestamp);
+            assertThat(processingTime).isEqualTo(expectedProcessingTime);
+            assertThat(watermark).isEqualTo(expectedWatermark);
 
             return element;
         }
@@ -405,8 +394,8 @@ public class BucketsTest {
     }
 
     @Test
-    public void testBucketLifeCycleListenerOnCreatingAndInactive() throws Exception {
-        File outDir = TEMP_FOLDER.newFolder();
+    void testBucketLifeCycleListenerOnCreatingAndInactive() throws Exception {
+        File outDir = TempDirUtils.newFolder(tempFolder);
         Path path = new Path(outDir.toURI());
         OnProcessingTimePolicy<String, String> rollOnProcessingTimeCountingPolicy =
                 new OnProcessingTimePolicy<>(2L);
@@ -441,12 +430,12 @@ public class BucketsTest {
                         new Tuple2<>(RecordBucketLifeCycleListener.EventType.CREATED, "test2"),
                         new Tuple2<>(RecordBucketLifeCycleListener.EventType.INACTIVE, "test1"),
                         new Tuple2<>(RecordBucketLifeCycleListener.EventType.INACTIVE, "test2"));
-        Assert.assertEquals(expectedEvents, bucketLifeCycleListener.getEvents());
+        assertThat(bucketLifeCycleListener.getEvents()).isEqualTo(expectedEvents);
     }
 
     @Test
-    public void testBucketLifeCycleListenerOnRestoring() throws Exception {
-        File outDir = TEMP_FOLDER.newFolder();
+    void testBucketLifeCycleListenerOnRestoring() throws Exception {
+        File outDir = TempDirUtils.newFolder(tempFolder);
         Path path = new Path(outDir.toURI());
         OnProcessingTimePolicy<String, String> rollOnProcessingTimeCountingPolicy =
                 new OnProcessingTimePolicy<>(2L);
@@ -482,15 +471,13 @@ public class BucketsTest {
                         partCounterContainer,
                         OutputFileConfig.builder().build());
 
-        Assert.assertEquals(
-                new HashSet<>(Collections.singletonList("test2")),
-                buckets.getActiveBuckets().keySet());
+        assertThat(buckets.getActiveBuckets().keySet()).containsOnly("test2");
         List<Tuple2<RecordBucketLifeCycleListener.EventType, String>> expectedEvents =
                 Arrays.asList(
                         new Tuple2<>(RecordBucketLifeCycleListener.EventType.CREATED, "test1"),
                         new Tuple2<>(RecordBucketLifeCycleListener.EventType.CREATED, "test2"),
                         new Tuple2<>(RecordBucketLifeCycleListener.EventType.INACTIVE, "test1"));
-        Assert.assertEquals(expectedEvents, bucketLifeCycleListener.getEvents());
+        assertThat(bucketLifeCycleListener.getEvents()).isEqualTo(expectedEvents);
     }
 
     private static class RecordBucketLifeCycleListener
@@ -518,8 +505,8 @@ public class BucketsTest {
     }
 
     @Test
-    public void testFileLifeCycleListener() throws Exception {
-        File outDir = TEMP_FOLDER.newFolder();
+    void testFileLifeCycleListener() throws Exception {
+        File outDir = TempDirUtils.newFolder(tempFolder);
         Path path = new Path(outDir.toURI());
 
         OnProcessingTimePolicy<String, String> rollOnProcessingTimeCountingPolicy =
@@ -545,11 +532,10 @@ public class BucketsTest {
         buckets.onElement("test1", new TestUtils.MockSinkContext(null, 1L, 5L));
         buckets.onElement("test2", new TestUtils.MockSinkContext(null, 1L, 6L));
 
-        Assert.assertEquals(2, fileLifeCycleListener.files.size());
-        Assert.assertEquals(
-                Arrays.asList("part-0-0", "part-0-1"), fileLifeCycleListener.files.get("test1"));
-        Assert.assertEquals(
-                Collections.singletonList("part-0-1"), fileLifeCycleListener.files.get("test2"));
+        assertThat(fileLifeCycleListener.files).hasSize(2);
+        assertThat(fileLifeCycleListener.files.get("test1"))
+                .containsExactly("part-0-0", "part-0-1");
+        assertThat(fileLifeCycleListener.files.get("test2")).containsExactly("part-0-1");
     }
 
     private static class TestFileLifeCycleListener implements FileLifeCycleListener<String> {
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/filesystem/BulkWriterTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/filesystem/BulkWriterTest.java
index 0d39d027dc1..93ab7d061fa 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/filesystem/BulkWriterTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/filesystem/BulkWriterTest.java
@@ -23,13 +23,11 @@ import org.apache.flink.api.java.tuple.Tuple2;
 import org.apache.flink.core.fs.FSDataOutputStream;
 import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
 import org.apache.flink.streaming.util.OneInputStreamOperatorTestHarness;
+import org.apache.flink.testutils.junit.utils.TempDirUtils;
 import org.apache.flink.util.Preconditions;
-import org.apache.flink.util.TestLogger;
 
-import org.junit.Assert;
-import org.junit.ClassRule;
-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.io.IOException;
@@ -37,14 +35,16 @@ import java.nio.charset.Charset;
 import java.nio.charset.StandardCharsets;
 import java.util.Map;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 /** Tests for the {@link StreamingFileSink} with {@link BulkWriter}. */
-public class BulkWriterTest extends TestLogger {
+public class BulkWriterTest {
 
-    @ClassRule public static final TemporaryFolder TEMP_FOLDER = new TemporaryFolder();
+    @TempDir private static java.nio.file.Path tempFolder;
 
     @Test
-    public void testCustomBulkWriter() throws Exception {
-        final File outDir = TEMP_FOLDER.newFolder();
+    void testCustomBulkWriter() throws Exception {
+        final File outDir = TempDirUtils.newFolder(tempFolder);
 
         // we set the max bucket size to small so that we can know when it rolls
         try (OneInputStreamOperatorTestHarness<Tuple2<String, Integer>, Object> testHarness =
@@ -62,8 +62,8 @@ public class BulkWriterTest extends TestLogger {
     }
 
     @Test
-    public void testCustomBulkWriterWithBucketAssigner() throws Exception {
-        final File outDir = TEMP_FOLDER.newFolder();
+    void testCustomBulkWriterWithBucketAssigner() throws Exception {
+        final File outDir = TempDirUtils.newFolder(tempFolder);
 
         // we set the max bucket size to small so that we can know when it rolls
         try (OneInputStreamOperatorTestHarness<Tuple2<String, Integer>, Object> testHarness =
@@ -86,8 +86,8 @@ public class BulkWriterTest extends TestLogger {
     }
 
     @Test
-    public void testCustomBulkWriterWithPartConfig() throws Exception {
-        final File outDir = TEMP_FOLDER.newFolder();
+    void testCustomBulkWriterWithPartConfig() throws Exception {
+        final File outDir = TempDirUtils.newFolder(tempFolder);
 
         // we set the max bucket size to small so that we can know when it rolls
         try (OneInputStreamOperatorTestHarness<Tuple2<String, Integer>, Object> testHarness =
@@ -142,15 +142,15 @@ public class BulkWriterTest extends TestLogger {
         for (Map.Entry<File, String> fileContents : contents.entrySet()) {
             if (fileContents.getKey().getName().contains(partFileName1)) {
                 fileCounter++;
-                Assert.assertEquals("test1@1\n", fileContents.getValue());
+                assertThat(fileContents.getValue()).isEqualTo("test1@1\n");
             } else if (fileContents.getKey().getName().contains(partFileName2)) {
                 fileCounter++;
-                Assert.assertEquals("test1@2\ntest1@3\n", fileContents.getValue());
+                assertThat(fileContents.getValue()).isEqualTo("test1@2\ntest1@3\n");
             }
             // check bucket name
-            Assert.assertEquals("test1", fileContents.getKey().getParentFile().getName());
+            assertThat(fileContents.getKey().getParentFile().getName()).isEqualTo("test1");
         }
-        Assert.assertEquals(2L, fileCounter);
+        assertThat(fileCounter).isEqualTo(2L);
 
         // we acknowledge the latest checkpoint, so everything should be published.
         testHarness.notifyOfCompletedCheckpoint(2L);
@@ -190,19 +190,19 @@ public class BulkWriterTest extends TestLogger {
         for (Map.Entry<File, String> fileContents : contents.entrySet()) {
             if (fileContents.getKey().getName().contains(partFileName1)) {
                 fileCounter++;
-                Assert.assertEquals("test1@1\n", fileContents.getValue());
-                Assert.assertEquals("1", fileContents.getKey().getParentFile().getName());
+                assertThat(fileContents.getValue()).isEqualTo("test1@1\n");
+                assertThat(fileContents.getKey().getParentFile().getName()).isEqualTo("1");
             } else if (fileContents.getKey().getName().contains(partFileName2)) {
                 fileCounter++;
-                Assert.assertEquals("test1@2\n", fileContents.getValue());
-                Assert.assertEquals("2", fileContents.getKey().getParentFile().getName());
+                assertThat(fileContents.getValue()).isEqualTo("test1@2\n");
+                assertThat(fileContents.getKey().getParentFile().getName()).isEqualTo("2");
             } else if (fileContents.getKey().getName().contains(partFileName3)) {
                 fileCounter++;
-                Assert.assertEquals("test1@3\n", fileContents.getValue());
-                Assert.assertEquals("3", fileContents.getKey().getParentFile().getName());
+                assertThat(fileContents.getValue()).isEqualTo("test1@3\n");
+                assertThat(fileContents.getKey().getParentFile().getName()).isEqualTo("3");
             }
         }
-        Assert.assertEquals(3L, fileCounter);
+        assertThat(fileCounter).isEqualTo(3L);
 
         // we acknowledge the latest checkpoint, so everything should be published.
         testHarness.notifyOfCompletedCheckpoint(2L);
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/filesystem/LocalStreamingFileSinkTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/filesystem/LocalStreamingFileSinkTest.java
index b8853e0ae03..c524deca4f5 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/filesystem/LocalStreamingFileSinkTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/filesystem/LocalStreamingFileSinkTest.java
@@ -27,25 +27,25 @@ import org.apache.flink.streaming.api.functions.sink.filesystem.rollingpolicies.
 import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
 import org.apache.flink.streaming.util.AbstractStreamOperatorTestHarness;
 import org.apache.flink.streaming.util.OneInputStreamOperatorTestHarness;
-import org.apache.flink.util.TestLogger;
+import org.apache.flink.testutils.junit.utils.TempDirUtils;
 
-import org.junit.Assert;
-import org.junit.ClassRule;
-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.time.Duration;
 import java.util.Map;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 /** Tests for the {@link StreamingFileSink}. */
-public class LocalStreamingFileSinkTest extends TestLogger {
+class LocalStreamingFileSinkTest {
 
-    @ClassRule public static final TemporaryFolder TEMP_FOLDER = new TemporaryFolder();
+    @TempDir private static java.nio.file.Path tempFolder;
 
     @Test
-    public void testClosingWithoutInput() throws Exception {
-        final File outDir = TEMP_FOLDER.newFolder();
+    void testClosingWithoutInput() throws Exception {
+        final File outDir = TempDirUtils.newFolder(tempFolder);
 
         try (OneInputStreamOperatorTestHarness<Tuple2<String, Integer>, Object> testHarness =
                 TestUtils.createRescalingTestSink(outDir, 1, 0, 100L, 124L); ) {
@@ -55,8 +55,8 @@ public class LocalStreamingFileSinkTest extends TestLogger {
     }
 
     @Test
-    public void testClosingWithoutInitializingStateShouldNotFail() throws Exception {
-        final File outDir = TEMP_FOLDER.newFolder();
+    void testClosingWithoutInitializingStateShouldNotFail() throws Exception {
+        final File outDir = TempDirUtils.newFolder(tempFolder);
 
         try (OneInputStreamOperatorTestHarness<Tuple2<String, Integer>, Object> testHarness =
                 TestUtils.createRescalingTestSink(outDir, 1, 0, 100L, 124L)) {
@@ -65,8 +65,8 @@ public class LocalStreamingFileSinkTest extends TestLogger {
     }
 
     @Test
-    public void testTruncateAfterRecoveryAndOverwrite() throws Exception {
-        final File outDir = TEMP_FOLDER.newFolder();
+    void testTruncateAfterRecoveryAndOverwrite() throws Exception {
+        final File outDir = TempDirUtils.newFolder(tempFolder);
         OperatorSubtaskState snapshot;
 
         // we set the max bucket size to small so that we can know when it rolls
@@ -94,13 +94,13 @@ public class LocalStreamingFileSinkTest extends TestLogger {
             for (Map.Entry<File, String> fileContents : contents.entrySet()) {
                 if (fileContents.getKey().getName().contains(".part-0-0.inprogress")) {
                     fileCounter++;
-                    Assert.assertEquals("test1@1\ntest1@2\n", fileContents.getValue());
+                    assertThat(fileContents.getValue()).isEqualTo("test1@1\ntest1@2\n");
                 } else if (fileContents.getKey().getName().contains(".part-0-1.inprogress")) {
                     fileCounter++;
-                    Assert.assertEquals("test1@3\n", fileContents.getValue());
+                    assertThat(fileContents.getValue()).isEqualTo("test1@3\n");
                 }
             }
-            Assert.assertEquals(2L, fileCounter);
+            assertThat(fileCounter).isEqualTo(2L);
         }
 
         try (OneInputStreamOperatorTestHarness<Tuple2<String, Integer>, Object> testHarness =
@@ -121,14 +121,14 @@ public class LocalStreamingFileSinkTest extends TestLogger {
                 if (fileContents.getKey().getName().contains(".part-0-0.inprogress")) {
                     // truncated
                     fileCounter++;
-                    Assert.assertEquals("test1@1\n", fileContents.getValue());
+                    assertThat(fileContents.getValue()).isEqualTo("test1@1\n");
                 } else if (fileContents.getKey().getName().contains(".part-0-1.inprogress")) {
                     // ignored for now as we do not clean up. This will be overwritten.
                     fileCounter++;
-                    Assert.assertEquals("test1@3\n", fileContents.getValue());
+                    assertThat(fileContents.getValue()).isEqualTo("test1@3\n");
                 }
             }
-            Assert.assertEquals(2L, fileCounter);
+            assertThat(fileCounter).isEqualTo(2L);
 
             // the first closes part-0-0 and the second will open part-0-1
             testHarness.processElement(new StreamRecord<>(Tuple2.of("test1", 4), 4L));
@@ -138,14 +138,14 @@ public class LocalStreamingFileSinkTest extends TestLogger {
                     TestUtils.getFileContentByPath(outDir).entrySet()) {
                 if (fileContents.getKey().getName().contains(".part-0-0.inprogress")) {
                     fileCounter++;
-                    Assert.assertEquals("test1@1\ntest1@4\n", fileContents.getValue());
+                    assertThat(fileContents.getValue()).isEqualTo("test1@1\ntest1@4\n");
                 } else if (fileContents.getKey().getName().contains(".part-0-1.inprogress")) {
                     // ignored for now as we do not clean up. This will be overwritten.
                     fileCounter++;
-                    Assert.assertEquals("test1@3\n", fileContents.getValue());
+                    assertThat(fileContents.getValue()).isEqualTo("test1@3\n");
                 }
             }
-            Assert.assertEquals(2L, fileCounter);
+            assertThat(fileCounter).isEqualTo(2L);
 
             testHarness.processElement(new StreamRecord<>(Tuple2.of("test1", 5), 5L));
             TestUtils.checkLocalFs(
@@ -163,7 +163,7 @@ public class LocalStreamingFileSinkTest extends TestLogger {
                     TestUtils.getFileContentByPath(outDir).entrySet()) {
                 if (fileContents.getKey().getName().contains(".part-0-0.inprogress")) {
                     fileCounter++;
-                    Assert.assertEquals("test1@1\ntest1@4\n", fileContents.getValue());
+                    assertThat(fileContents.getValue()).isEqualTo("test1@1\ntest1@4\n");
                 } else if (fileContents.getKey().getName().contains(".part-0-1.inprogress")) {
                     if (fileContents.getValue().equals("test1@5\ntest1@6\n")
                             || fileContents.getValue().equals("test1@3\n")) {
@@ -171,7 +171,7 @@ public class LocalStreamingFileSinkTest extends TestLogger {
                     }
                 }
             }
-            Assert.assertEquals(3L, fileCounter);
+            assertThat(fileCounter).isEqualTo(3L);
 
             // this will publish part-0-0
             testHarness.notifyOfCompletedCheckpoint(2L);
@@ -182,7 +182,7 @@ public class LocalStreamingFileSinkTest extends TestLogger {
                     TestUtils.getFileContentByPath(outDir).entrySet()) {
                 if (fileContents.getKey().getName().equals("part-0-0")) {
                     fileCounter++;
-                    Assert.assertEquals("test1@1\ntest1@4\n", fileContents.getValue());
+                    assertThat(fileContents.getValue()).isEqualTo("test1@1\ntest1@4\n");
                 } else if (fileContents.getKey().getName().contains(".part-0-1.inprogress")) {
                     if (fileContents.getValue().equals("test1@5\ntest1@6\n")
                             || fileContents.getValue().equals("test1@3\n")) {
@@ -190,13 +190,13 @@ public class LocalStreamingFileSinkTest extends TestLogger {
                     }
                 }
             }
-            Assert.assertEquals(3L, fileCounter);
+            assertThat(fileCounter).isEqualTo(3L);
         }
     }
 
     @Test
-    public void testCommitStagedFilesInCorrectOrder() throws Exception {
-        final File outDir = TEMP_FOLDER.newFolder();
+    void testCommitStagedFilesInCorrectOrder() throws Exception {
+        final File outDir = TempDirUtils.newFolder(tempFolder);
 
         // we set the max bucket size to small so that we can know when it rolls
         try (OneInputStreamOperatorTestHarness<Tuple2<String, Integer>, Object> testHarness =
@@ -247,19 +247,19 @@ public class LocalStreamingFileSinkTest extends TestLogger {
                     TestUtils.getFileContentByPath(outDir).entrySet()) {
                 if (fileContents.getKey().getName().equals("part-0-0")) {
                     fileCounter++;
-                    Assert.assertEquals("test1@1\ntest1@2\n", fileContents.getValue());
+                    assertThat(fileContents.getValue()).isEqualTo("test1@1\ntest1@2\n");
                 } else if (fileContents.getKey().getName().contains(".part-0-1.inprogress")) {
                     fileCounter++;
-                    Assert.assertEquals("test1@3\ntest1@4\n", fileContents.getValue());
+                    assertThat(fileContents.getValue()).isEqualTo("test1@3\ntest1@4\n");
                 } else if (fileContents.getKey().getName().contains(".part-0-2.inprogress")) {
                     fileCounter++;
-                    Assert.assertEquals("test1@5\ntest1@6\n", fileContents.getValue());
+                    assertThat(fileContents.getValue()).isEqualTo("test1@5\ntest1@6\n");
                 } else if (fileContents.getKey().getName().contains(".part-0-3.inprogress")) {
                     fileCounter++;
-                    Assert.assertEquals("test1@7\n", fileContents.getValue());
+                    assertThat(fileContents.getValue()).isEqualTo("test1@7\n");
                 }
             }
-            Assert.assertEquals(4L, fileCounter);
+            assertThat(fileCounter).isEqualTo(4L);
 
             testHarness.notifyOfCompletedCheckpoint(
                     3L); // all the pending for checkpoint 2 and 3 are committed
@@ -270,25 +270,25 @@ public class LocalStreamingFileSinkTest extends TestLogger {
                     TestUtils.getFileContentByPath(outDir).entrySet()) {
                 if (fileContents.getKey().getName().equals("part-0-0")) {
                     fileCounter++;
-                    Assert.assertEquals("test1@1\ntest1@2\n", fileContents.getValue());
+                    assertThat(fileContents.getValue()).isEqualTo("test1@1\ntest1@2\n");
                 } else if (fileContents.getKey().getName().equals("part-0-1")) {
                     fileCounter++;
-                    Assert.assertEquals("test1@3\ntest1@4\n", fileContents.getValue());
+                    assertThat(fileContents.getValue()).isEqualTo("test1@3\ntest1@4\n");
                 } else if (fileContents.getKey().getName().equals("part-0-2")) {
                     fileCounter++;
-                    Assert.assertEquals("test1@5\ntest1@6\n", fileContents.getValue());
+                    assertThat(fileContents.getValue()).isEqualTo("test1@5\ntest1@6\n");
                 } else if (fileContents.getKey().getName().equals("part-0-3")) {
                     fileCounter++;
-                    Assert.assertEquals("test1@7\n", fileContents.getValue());
+                    assertThat(fileContents.getValue()).isEqualTo("test1@7\n");
                 }
             }
-            Assert.assertEquals(4L, fileCounter);
+            assertThat(fileCounter).isEqualTo(4L);
         }
     }
 
     @Test
-    public void testInactivityPeriodWithLateNotify() throws Exception {
-        final File outDir = TEMP_FOLDER.newFolder();
+    void testInactivityPeriodWithLateNotify() throws Exception {
+        final File outDir = TempDirUtils.newFolder(tempFolder);
 
         // we set a big bucket size so that it does not close by size, but by timers.
         try (OneInputStreamOperatorTestHarness<Tuple2<String, Integer>, Object> testHarness =
@@ -312,8 +312,8 @@ public class LocalStreamingFileSinkTest extends TestLogger {
                     bucketCounter++;
                 }
             }
-            Assert.assertEquals(
-                    2L, bucketCounter); // verifies that we have 2 buckets, "test1" and "test2"
+            assertThat(bucketCounter)
+                    .isEqualTo(2L); // verifies that we have 2 buckets, "test1" and "test2"
 
             testHarness.setProcessingTime(101L); // put them in pending
             TestUtils.checkLocalFs(outDir, 2, 0);
@@ -339,19 +339,19 @@ public class LocalStreamingFileSinkTest extends TestLogger {
                     TestUtils.getFileContentByPath(outDir).entrySet()) {
                 if (fileContents.getKey().getParentFile().getName().equals("test1")) {
                     bucketCounter++;
-                    Assert.assertEquals("part-0-0", fileContents.getKey().getName());
-                    Assert.assertEquals("test1@1\n", fileContents.getValue());
+                    assertThat(fileContents.getKey().getName()).isEqualTo("part-0-0");
+                    assertThat(fileContents.getValue()).isEqualTo("test1@1\n");
                 } else if (fileContents.getKey().getParentFile().getName().equals("test2")) {
                     bucketCounter++;
-                    Assert.assertEquals("part-0-1", fileContents.getKey().getName());
-                    Assert.assertEquals("test2@1\n", fileContents.getValue());
+                    assertThat(fileContents.getKey().getName()).isEqualTo("part-0-1");
+                    assertThat(fileContents.getValue()).isEqualTo("test2@1\n");
                 } else if (fileContents.getKey().getParentFile().getName().equals("test3")) {
                     bucketCounter++;
                 } else if (fileContents.getKey().getParentFile().getName().equals("test4")) {
                     bucketCounter++;
                 }
             }
-            Assert.assertEquals(4L, bucketCounter);
+            assertThat(bucketCounter).isEqualTo(4L);
 
             testHarness.notifyOfCompletedCheckpoint(
                     1L); // put the pending for 1 to the "committed" state
@@ -362,27 +362,27 @@ public class LocalStreamingFileSinkTest extends TestLogger {
                     TestUtils.getFileContentByPath(outDir).entrySet()) {
                 if (fileContents.getKey().getParentFile().getName().equals("test1")) {
                     bucketCounter++;
-                    Assert.assertEquals("test1@1\n", fileContents.getValue());
+                    assertThat(fileContents.getValue()).isEqualTo("test1@1\n");
                 } else if (fileContents.getKey().getParentFile().getName().equals("test2")) {
                     bucketCounter++;
-                    Assert.assertEquals("test2@1\n", fileContents.getValue());
+                    assertThat(fileContents.getValue()).isEqualTo("test2@1\n");
                 } else if (fileContents.getKey().getParentFile().getName().equals("test3")) {
                     bucketCounter++;
-                    Assert.assertEquals("part-0-2", fileContents.getKey().getName());
-                    Assert.assertEquals("test3@1\n", fileContents.getValue());
+                    assertThat(fileContents.getKey().getName()).isEqualTo("part-0-2");
+                    assertThat(fileContents.getValue()).isEqualTo("test3@1\n");
                 } else if (fileContents.getKey().getParentFile().getName().equals("test4")) {
                     bucketCounter++;
-                    Assert.assertEquals("part-0-3", fileContents.getKey().getName());
-                    Assert.assertEquals("test4@1\n", fileContents.getValue());
+                    assertThat(fileContents.getKey().getName()).isEqualTo("part-0-3");
+                    assertThat(fileContents.getValue()).isEqualTo("test4@1\n");
                 }
             }
-            Assert.assertEquals(4L, bucketCounter);
+            assertThat(bucketCounter).isEqualTo(4L);
         }
     }
 
     @Test
-    public void testClosingOnSnapshot() throws Exception {
-        final File outDir = TEMP_FOLDER.newFolder();
+    void testClosingOnSnapshot() throws Exception {
+        final File outDir = TempDirUtils.newFolder(tempFolder);
 
         try (OneInputStreamOperatorTestHarness<Tuple2<String, Integer>, Object> testHarness =
                 TestUtils.createRescalingTestSink(outDir, 1, 0, 100L, 2L)) {
@@ -419,8 +419,8 @@ public class LocalStreamingFileSinkTest extends TestLogger {
     }
 
     @Test
-    public void testClosingWithCustomizedBucketer() throws Exception {
-        final File outDir = TEMP_FOLDER.newFolder();
+    void testClosingWithCustomizedBucketer() throws Exception {
+        final File outDir = TempDirUtils.newFolder(tempFolder);
         final long partMaxSize = 2L;
         final long inactivityInterval = 100L;
         final RollingPolicy<Tuple2<String, Integer>, Integer> rollingPolicy =
@@ -477,15 +477,15 @@ public class LocalStreamingFileSinkTest extends TestLogger {
         for (Map.Entry<File, String> fileContents : contents.entrySet()) {
             Integer bucketId = Integer.parseInt(fileContents.getKey().getParentFile().getName());
 
-            Assert.assertTrue(bucketId >= 1 && bucketId <= 4);
-            Assert.assertEquals(
-                    String.format("test%d@%d\n", bucketId, bucketId), fileContents.getValue());
+            assertThat(bucketId).isBetween(1, 4);
+            assertThat(fileContents.getValue())
+                    .isEqualTo(String.format("test%d@%d\n", bucketId, bucketId));
         }
     }
 
     @Test
-    public void testScalingDownAndMergingOfStates() throws Exception {
-        final File outDir = TEMP_FOLDER.newFolder();
+    void testScalingDownAndMergingOfStates() throws Exception {
+        final File outDir = TempDirUtils.newFolder(tempFolder);
 
         OperatorSubtaskState mergedSnapshot;
 
@@ -524,7 +524,7 @@ public class LocalStreamingFileSinkTest extends TestLogger {
                     counter++;
                 }
             }
-            Assert.assertEquals(3L, counter);
+            assertThat(counter).isEqualTo(3L);
 
             // intentionally we snapshot them in the reverse order so that the states are shuffled
             mergedSnapshot =
@@ -560,17 +560,15 @@ public class LocalStreamingFileSinkTest extends TestLogger {
                     // consumed in the initialize state.
                     if (filename.contains("-0.inprogress") || filename.endsWith("-0")) {
                         counter++;
-                        Assert.assertTrue(
-                                fileContents.getValue().equals("test1@1\n")
-                                        || fileContents.getValue().equals("test1@0\n"));
+                        assertThat(fileContents.getValue()).isIn("test1@1\n", "test1@0\n");
                     }
                 } else if (parentFilename.equals("test2")
                         && filename.contains(".part-1-1.inprogress")) {
                     counter++;
-                    Assert.assertEquals("test2@1\n", fileContents.getValue());
+                    assertThat(fileContents.getValue()).isEqualTo("test2@1\n");
                 }
             }
-            Assert.assertEquals(3L, counter);
+            assertThat(counter).isEqualTo(3L);
         }
     }
 }
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/filesystem/TestUtils.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/filesystem/TestUtils.java
index aba2801d63e..0a45d7f4f7d 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/filesystem/TestUtils.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/filesystem/TestUtils.java
@@ -32,7 +32,6 @@ import org.apache.flink.streaming.api.operators.StreamSink;
 import org.apache.flink.streaming.util.OneInputStreamOperatorTestHarness;
 
 import org.apache.commons.io.FileUtils;
-import org.junit.Assert;
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
@@ -52,6 +51,7 @@ import java.util.List;
 import java.util.Map;
 
 import static org.apache.flink.streaming.api.functions.sink.filesystem.rollingpolicies.OnCheckpointRollingPolicy.build;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /** Utilities for the {@link StreamingFileSink} tests. */
 public class TestUtils {
@@ -245,8 +245,8 @@ public class TestUtils {
             }
         }
 
-        Assert.assertEquals(expectedInProgress, inProgress);
-        Assert.assertEquals(expectedCompleted, finished);
+        assertThat(inProgress).isEqualTo(expectedInProgress);
+        assertThat(finished).isEqualTo(expectedCompleted);
     }
 
     static Map<File, String> getFileContentByPath(File directory) throws IOException {
@@ -324,9 +324,9 @@ public class TestUtils {
             return bytes;
         }
 
-        public Integer deserialize(int version, byte[] serialized) throws IOException {
-            Assert.assertEquals(1L, (long) version);
-            Assert.assertEquals(4L, serialized.length);
+        public Integer deserialize(int version, byte[] serialized) {
+            assertThat(version).isOne();
+            assertThat(serialized.length).isEqualTo(4);
             return ByteBuffer.wrap(serialized).order(ByteOrder.LITTLE_ENDIAN).getInt();
         }
     }
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/source/ContinuousFileReaderOperatorTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/source/ContinuousFileReaderOperatorTest.java
index b7c1dc9dd1b..f8779fe9df9 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/source/ContinuousFileReaderOperatorTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/source/ContinuousFileReaderOperatorTest.java
@@ -29,43 +29,59 @@ import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
 import org.apache.flink.streaming.runtime.tasks.mailbox.Mail;
 import org.apache.flink.streaming.util.OneInputStreamOperatorTestHarness;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.fail;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 /** {@link ContinuousFileReaderOperator} test. */
-public class ContinuousFileReaderOperatorTest {
+class ContinuousFileReaderOperatorTest {
 
-    @Test(expected = ExpectedTestException.class)
-    public void testExceptionRethrownFromClose() throws Exception {
+    @Test
+    void testExceptionRethrownFromClose() throws Exception {
         OneInputStreamOperatorTestHarness<TimestampedFileInputSplit, String> harness =
                 createHarness(failingFormat());
         harness.getExecutionConfig().setAutoWatermarkInterval(10);
         harness.setTimeCharacteristic(TimeCharacteristic.IngestionTime);
-        try (OneInputStreamOperatorTestHarness<TimestampedFileInputSplit, String> tester =
-                harness) {
-            tester.open();
-        }
+
+        assertThatThrownBy(
+                        () -> {
+                            try (OneInputStreamOperatorTestHarness<
+                                            TimestampedFileInputSplit, String>
+                                    tester = harness) {
+                                tester.open();
+                            }
+                        })
+                .isInstanceOf(ExpectedTestException.class);
     }
 
-    @Test(expected = ExpectedTestException.class)
-    public void testExceptionRethrownFromProcessElement() throws Exception {
+    @Test
+    void testExceptionRethrownFromProcessElement() throws Exception {
         OneInputStreamOperatorTestHarness<TimestampedFileInputSplit, String> harness =
                 createHarness(failingFormat());
         harness.getExecutionConfig().setAutoWatermarkInterval(10);
         harness.setTimeCharacteristic(TimeCharacteristic.IngestionTime);
-        try (OneInputStreamOperatorTestHarness<TimestampedFileInputSplit, String> tester =
-                harness) {
-            tester.open();
-            tester.processElement(
-                    new StreamRecord<>(
-                            new TimestampedFileInputSplit(
-                                    0L, 1, new Path(), 0L, 0L, new String[] {})));
-            for (Mail m : harness.getTaskMailbox().drain()) {
-                m.run();
-            }
-            fail("should throw from processElement");
-        }
+
+        assertThatThrownBy(
+                        () -> {
+                            try (OneInputStreamOperatorTestHarness<
+                                            TimestampedFileInputSplit, String>
+                                    tester = harness) {
+                                tester.open();
+                                tester.processElement(
+                                        new StreamRecord<>(
+                                                new TimestampedFileInputSplit(
+                                                        0L,
+                                                        1,
+                                                        new Path(),
+                                                        0L,
+                                                        0L,
+                                                        new String[] {})));
+                                for (Mail m : harness.getTaskMailbox().drain()) {
+                                    m.run();
+                                }
+                            }
+                        })
+                .isInstanceOf(ExpectedTestException.class);
     }
 
     private FileInputFormat<String> failingFormat() {
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/source/FileMonitoringFunctionTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/source/FileMonitoringFunctionTest.java
index 9781b0f3328..72e0ccc765a 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/source/FileMonitoringFunctionTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/source/FileMonitoringFunctionTest.java
@@ -21,13 +21,13 @@ package org.apache.flink.streaming.api.functions.source;
 import org.apache.flink.api.java.tuple.Tuple3;
 import org.apache.flink.streaming.api.watermark.Watermark;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 /** Tests for the {@link org.apache.flink.streaming.api.functions.source.FileMonitoringFunction}. */
-public class FileMonitoringFunctionTest {
+class FileMonitoringFunctionTest {
 
     @Test
-    public void testForEmptyLocation() throws Exception {
+    void testForEmptyLocation() throws Exception {
         final FileMonitoringFunction fileMonitoringFunction =
                 new FileMonitoringFunction(
                         "?non-existing-path", 1L, FileMonitoringFunction.WatchType.ONLY_NEW_FILES);
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/source/InputFormatSourceFunctionTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/source/InputFormatSourceFunctionTest.java
index 5d149c5f2b7..3880969d04b 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/source/InputFormatSourceFunctionTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/source/InputFormatSourceFunctionTest.java
@@ -39,22 +39,23 @@ import org.apache.flink.streaming.api.operators.AbstractStreamOperator;
 import org.apache.flink.streaming.api.operators.StreamingRuntimeContext;
 import org.apache.flink.streaming.api.watermark.Watermark;
 
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import java.io.IOException;
 import java.util.Collections;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 /** Tests for {@link InputFormatSourceFunction}. */
-public class InputFormatSourceFunctionTest {
+class InputFormatSourceFunctionTest {
 
     @Test
-    public void testNormalOp() throws Exception {
+    void testNormalOp() throws Exception {
         testFormatLifecycle(false);
     }
 
     @Test
-    public void testCancelation() throws Exception {
+    void testCancelation() throws Exception {
         testFormatLifecycle(true);
     }
 
@@ -75,24 +76,24 @@ public class InputFormatSourceFunctionTest {
 
             reader.setRuntimeContext(new MockRuntimeContext(format, noOfSplits, environment));
 
-            Assert.assertTrue(!format.isConfigured);
-            Assert.assertTrue(!format.isInputFormatOpen);
-            Assert.assertTrue(!format.isSplitOpen);
+            assertThat(format.isConfigured).isFalse();
+            assertThat(format.isInputFormatOpen).isFalse();
+            assertThat(format.isSplitOpen).isFalse();
 
             reader.open(DefaultOpenContext.INSTANCE);
-            Assert.assertTrue(format.isConfigured);
+            assertThat(format.isConfigured).isTrue();
 
             TestSourceContext ctx = new TestSourceContext(reader, format, midCancel, cancelAt);
             reader.run(ctx);
 
             int splitsSeen = ctx.getSplitsSeen();
-            Assert.assertTrue(midCancel ? splitsSeen == cancelAt : splitsSeen == noOfSplits);
+            assertThat(midCancel ? splitsSeen == cancelAt : splitsSeen == noOfSplits).isTrue();
 
             // we have exhausted the splits so the
             // format and splits should be closed by now
 
-            Assert.assertTrue(!format.isSplitOpen);
-            Assert.assertTrue(!format.isInputFormatOpen);
+            assertThat(format.isSplitOpen).isFalse();
+            assertThat(format.isInputFormatOpen).isFalse();
         }
     }
 
@@ -113,21 +114,21 @@ public class InputFormatSourceFunctionTest {
 
         @Override
         public void openInputFormat() {
-            Assert.assertTrue(isConfigured);
-            Assert.assertTrue(!isInputFormatOpen);
-            Assert.assertTrue(!isSplitOpen);
+            assertThat(isConfigured).isTrue();
+            assertThat(isInputFormatOpen).isFalse();
+            assertThat(isSplitOpen).isFalse();
             this.isInputFormatOpen = true;
         }
 
         @Override
         public void closeInputFormat() {
-            Assert.assertTrue(!isSplitOpen);
+            assertThat(isSplitOpen).isFalse();
             this.isInputFormatOpen = false;
         }
 
         @Override
         public void configure(Configuration parameters) {
-            Assert.assertTrue(!isConfigured);
+            assertThat(isConfigured).isFalse();
             this.isConfigured = true;
         }
 
@@ -138,7 +139,7 @@ public class InputFormatSourceFunctionTest {
 
         @Override
         public InputSplit[] createInputSplits(int minNumSplits) throws IOException {
-            Assert.assertTrue(isConfigured);
+            assertThat(isConfigured).isTrue();
             InputSplit[] splits = new InputSplit[minNumSplits];
             for (int i = 0; i < minNumSplits; i++) {
                 final int idx = i;
@@ -164,9 +165,9 @@ public class InputFormatSourceFunctionTest {
         public void open(InputSplit split) throws IOException {
             // whenever a new split opens,
             // the previous should have been closed
-            Assert.assertTrue(isInputFormatOpen);
-            Assert.assertTrue(isConfigured);
-            Assert.assertTrue(!isSplitOpen);
+            assertThat(isInputFormatOpen).isTrue();
+            assertThat(isConfigured).isTrue();
+            assertThat(isSplitOpen).isFalse();
 
             isSplitOpen = true;
             eos = false;
@@ -174,9 +175,9 @@ public class InputFormatSourceFunctionTest {
 
         @Override
         public boolean reachedEnd() throws IOException {
-            Assert.assertTrue(isInputFormatOpen);
-            Assert.assertTrue(isConfigured);
-            Assert.assertTrue(isSplitOpen);
+            assertThat(isInputFormatOpen).isTrue();
+            assertThat(isConfigured).isTrue();
+            assertThat(isSplitOpen).isTrue();
 
             if (!eos) {
                 reachedEndCalls++;
@@ -186,11 +187,11 @@ public class InputFormatSourceFunctionTest {
 
         @Override
         public Integer nextRecord(Integer reuse) throws IOException {
-            Assert.assertTrue(isInputFormatOpen);
-            Assert.assertTrue(isConfigured);
-            Assert.assertTrue(isSplitOpen);
+            assertThat(isInputFormatOpen).isTrue();
+            assertThat(isConfigured).isTrue();
+            assertThat(isSplitOpen).isTrue();
 
-            Assert.assertTrue(reachedEndCalls == ++nextRecordCalls);
+            assertThat(++nextRecordCalls).isEqualTo(reachedEndCalls);
 
             eos = true;
             return splitCounter++;
@@ -224,8 +225,8 @@ public class InputFormatSourceFunctionTest {
 
         @Override
         public void collect(Integer element) {
-            Assert.assertTrue(format.isSplitOpen);
-            Assert.assertTrue(splitIdx == element);
+            assertThat(format.isInputFormatOpen).isTrue();
+            assertThat(splitIdx).isEqualTo(element);
             if (shouldCancel && splitIdx == cancelAt) {
                 reader.cancel();
             } else {
@@ -291,7 +292,7 @@ public class InputFormatSourceFunctionTest {
         public InputSplitProvider getInputSplitProvider() {
             try {
                 this.inputSplits = format.createInputSplits(noOfSplits);
-                Assert.assertTrue(inputSplits.length == noOfSplits);
+                assertThat(inputSplits).hasSize(noOfSplits);
             } catch (IOException e) {
                 e.printStackTrace();
             }
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/source/SocketTextStreamFunctionTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/source/SocketTextStreamFunctionTest.java
index 13543842459..957029e0af6 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/source/SocketTextStreamFunctionTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/source/SocketTextStreamFunctionTest.java
@@ -22,25 +22,24 @@ import org.apache.flink.streaming.api.watermark.Watermark;
 import org.apache.flink.util.NetUtils;
 
 import org.apache.commons.io.IOUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import java.io.EOFException;
 import java.io.OutputStreamWriter;
 import java.net.ServerSocket;
 import java.net.Socket;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /**
  * Tests for the {@link org.apache.flink.streaming.api.functions.source.SocketTextStreamFunction}.
  */
-public class SocketTextStreamFunctionTest {
+class SocketTextStreamFunctionTest {
 
     private static final String LOCALHOST = "127.0.0.1";
 
     @Test
-    public void testSocketSourceSimpleOutput() throws Exception {
+    void testSocketSourceSimpleOutput() throws Exception {
         ServerSocket server = new ServerSocket(0);
         Socket channel = null;
 
@@ -74,7 +73,7 @@ public class SocketTextStreamFunctionTest {
     }
 
     @Test
-    public void testExitNoRetries() throws Exception {
+    void testExitNoRetries() throws Exception {
         ServerSocket server = new ServerSocket(0);
         Socket channel = null;
 
@@ -91,7 +90,7 @@ public class SocketTextStreamFunctionTest {
             try {
                 runner.waitUntilDone();
             } catch (Exception e) {
-                assertTrue(e.getCause() instanceof EOFException);
+                assertThat(e).hasCauseInstanceOf(EOFException.class);
             }
         } finally {
             if (channel != null) {
@@ -102,7 +101,7 @@ public class SocketTextStreamFunctionTest {
     }
 
     @Test
-    public void testSocketSourceOutputWithRetries() throws Exception {
+    void testSocketSourceOutputWithRetries() throws Exception {
         ServerSocket server = new ServerSocket(0);
         Socket channel = null;
 
@@ -146,7 +145,7 @@ public class SocketTextStreamFunctionTest {
     }
 
     @Test
-    public void testSocketSourceOutputInfiniteRetries() throws Exception {
+    void testSocketSourceOutputInfiniteRetries() throws Exception {
         ServerSocket server = new ServerSocket(0);
         Socket channel = null;
 
@@ -190,7 +189,7 @@ public class SocketTextStreamFunctionTest {
     }
 
     @Test
-    public void testSocketSourceOutputAcrossRetries() throws Exception {
+    void testSocketSourceOutputAcrossRetries() throws Exception {
         ServerSocket server = new ServerSocket(0);
         Socket channel = null;
 
@@ -273,7 +272,7 @@ public class SocketTextStreamFunctionTest {
                                 }
 
                                 if (expectedData != null && expectedData.length > pos) {
-                                    assertEquals(expectedData[pos], element);
+                                    assertThat(element).isEqualTo(expectedData[pos]);
                                 }
                             }
 
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/source/datagen/DataGeneratorSourceTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/source/datagen/DataGeneratorSourceTest.java
index 3462063a6f0..c853206498b 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/source/datagen/DataGeneratorSourceTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/source/datagen/DataGeneratorSourceTest.java
@@ -20,14 +20,13 @@ package org.apache.flink.streaming.api.functions.source.datagen;
 
 import org.apache.flink.core.testutils.OneShotLatch;
 import org.apache.flink.runtime.checkpoint.OperatorSubtaskState;
-import org.apache.flink.streaming.api.functions.StatefulSequenceSourceTest.BlockingSourceContext;
 import org.apache.flink.streaming.api.functions.source.SourceFunction;
 import org.apache.flink.streaming.api.operators.StreamSource;
 import org.apache.flink.streaming.api.watermark.Watermark;
 import org.apache.flink.streaming.util.AbstractStreamOperatorTestHarness;
+import org.apache.flink.streaming.util.BlockingSourceContext;
 
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import java.util.ArrayList;
 import java.util.HashSet;
@@ -37,11 +36,13 @@ import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.function.Supplier;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 /** Tests for {@link DataGeneratorSource}. */
 public class DataGeneratorSourceTest {
 
     @Test
-    public void testRandomGenerator() throws Exception {
+    void testRandomGenerator() throws Exception {
         long min = 10;
         long max = 20;
         DataGeneratorSource<Long> source =
@@ -87,12 +88,12 @@ public class DataGeneratorSourceTest {
                 });
 
         for (Long l : results) {
-            Assert.assertTrue(l >= min && l <= max);
+            assertThat(l).isBetween(min, max);
         }
     }
 
     @Test
-    public void testSequenceCheckpointRestore() throws Exception {
+    void testSequenceCheckpointRestore() throws Exception {
         final int initElement = 0;
         final int maxElement = 100;
         final Set<Long> expectedOutput = new HashSet<>();
@@ -214,7 +215,7 @@ public class DataGeneratorSourceTest {
         runner3.start();
         runner3.join();
 
-        Assert.assertEquals(3, outputCollector.size()); // we have 3 tasks.
+        assertThat(outputCollector).hasSize(3); // we have 3 tasks.
 
         // test for at-most-once
         Set<T> dedupRes = new HashSet<>(expectedOutput.size());
@@ -223,21 +224,17 @@ public class DataGeneratorSourceTest {
             List<T> elements = outputCollector.get(key);
 
             // this tests the correctness of the latches in the test
-            Assert.assertTrue(elements.size() > 0);
+            assertThat(elements).isNotEmpty();
 
             for (T elem : elements) {
-                if (!dedupRes.add(elem)) {
-                    Assert.fail("Duplicate entry: " + elem);
-                }
+                assertThat(dedupRes.add(elem)).as("Duplicate entry: " + elem).isTrue();
 
-                if (!expectedOutput.contains(elem)) {
-                    Assert.fail("Unexpected element: " + elem);
-                }
+                assertThat(expectedOutput).as("Unexpected element: " + elem).contains(elem);
             }
         }
 
         // test for exactly-once
-        Assert.assertEquals(expectedOutput.size(), dedupRes.size());
+        assertThat(dedupRes).hasSameSizeAs(expectedOutput);
 
         latchToWait1.trigger();
         latchToWait2.trigger();
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/ArrayFromTupleTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/ArrayFromTupleTest.java
index 673426a9be8..f4e5e7c5c6d 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/ArrayFromTupleTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/ArrayFromTupleTest.java
@@ -44,18 +44,18 @@ import org.apache.flink.api.java.tuple.Tuple7;
 import org.apache.flink.api.java.tuple.Tuple8;
 import org.apache.flink.api.java.tuple.Tuple9;
 
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertEquals;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /** Tests for {@link Tuple} to {@code Array}. */
-public class ArrayFromTupleTest {
+class ArrayFromTupleTest {
 
     private String[] testStrings;
 
-    @Before
-    public void init() {
+    @BeforeEach
+    void init() {
         testStrings = new String[Tuple.MAX_ARITY];
         for (int i = 0; i < Tuple.MAX_ARITY; i++) {
             testStrings[i] = Integer.toString(i);
@@ -63,8 +63,7 @@ public class ArrayFromTupleTest {
     }
 
     @Test
-    public void testConvertFromTupleToArray()
-            throws InstantiationException, IllegalAccessException {
+    void testConvertFromTupleToArray() throws InstantiationException, IllegalAccessException {
         for (int i = 0; i < Tuple.MAX_ARITY; i++) {
             Tuple currentTuple = (Tuple) CLASSES[i].newInstance();
             String[] currentArray = new String[i + 1];
@@ -77,7 +76,7 @@ public class ArrayFromTupleTest {
     }
 
     @Test
-    public void testUserSpecifiedOrder() throws InstantiationException, IllegalAccessException {
+    void testUserSpecifiedOrder() throws InstantiationException, IllegalAccessException {
         Tuple currentTuple = (Tuple) CLASSES[Tuple.MAX_ARITY - 1].newInstance();
         for (int i = 0; i < Tuple.MAX_ARITY; i++) {
             currentTuple.setField(testStrings[i], i);
@@ -131,10 +130,7 @@ public class ArrayFromTupleTest {
     }
 
     private void arrayEqualityCheck(Object[] array1, Object[] array2) {
-        assertEquals("The result arrays must have the same length", array1.length, array2.length);
-        for (int i = 0; i < array1.length; i++) {
-            assertEquals("Unequal fields at position " + i, array1[i], array2[i]);
-        }
+        assertThat(array1).isEqualTo(array2);
     }
 
     private static final Class<?>[] CLASSES =
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/ConcatenatedExtractTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/ConcatenatedExtractTest.java
index 2fc9be4b69b..dac243e40fb 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/ConcatenatedExtractTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/ConcatenatedExtractTest.java
@@ -19,13 +19,13 @@ package org.apache.flink.streaming.api.functions.windowing.delta.extractor;
 
 import org.apache.flink.api.java.tuple.Tuple2;
 
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertEquals;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /** Tests for {@link ConcatenatedExtract}. */
-public class ConcatenatedExtractTest {
+class ConcatenatedExtractTest {
 
     private String[] testStringArray1 = {"1", "2", "3"};
     private int[] testIntArray1 = {1, 2, 3};
@@ -38,34 +38,32 @@ public class ConcatenatedExtractTest {
     private Tuple2<Tuple2<String[], int[]>, Tuple2<String[], int[]>[]> testData;
 
     @SuppressWarnings("unchecked")
-    @Before
-    public void setupData() {
+    @BeforeEach
+    void setupData() {
         testTuple2Array = new Tuple2[2];
-        testTuple2Array[0] = new Tuple2<String[], int[]>(testStringArray1, testIntArray2);
-        testTuple2Array[1] = new Tuple2<String[], int[]>(testStringArray2, testIntArray1);
+        testTuple2Array[0] = new Tuple2<>(testStringArray1, testIntArray2);
+        testTuple2Array[1] = new Tuple2<>(testStringArray2, testIntArray1);
 
-        testTuple2 = new Tuple2<String[], int[]>(testStringArray3, testIntArray3);
+        testTuple2 = new Tuple2<>(testStringArray3, testIntArray3);
 
-        testData =
-                new Tuple2<Tuple2<String[], int[]>, Tuple2<String[], int[]>[]>(
-                        testTuple2, testTuple2Array);
+        testData = new Tuple2<>(testTuple2, testTuple2Array);
     }
 
     @SuppressWarnings({"rawtypes", "unchecked"})
     @Test
-    public void test1() {
+    void test1() {
         Extractor ext =
                 new ConcatenatedExtract(new FieldFromTuple(0), new FieldFromTuple(1))
                         .add(new FieldsFromArray(Integer.class, 2, 1, 0));
         int[] expected = {testIntArray3[2], testIntArray3[1], testIntArray3[0]};
-        assertEquals(new Integer(expected[0]), ((Integer[]) ext.extract(testData))[0]);
-        assertEquals(new Integer(expected[1]), ((Integer[]) ext.extract(testData))[1]);
-        assertEquals(new Integer(expected[2]), ((Integer[]) ext.extract(testData))[2]);
+        assertThat(((Integer[]) ext.extract(testData))[0]).isEqualTo(expected[0]);
+        assertThat(((Integer[]) ext.extract(testData))[1]).isEqualTo(expected[1]);
+        assertThat(((Integer[]) ext.extract(testData))[2]).isEqualTo(expected[2]);
     }
 
     @SuppressWarnings({"unchecked", "rawtypes"})
     @Test
-    public void test2() {
+    void test2() {
         Extractor ext =
                 new ConcatenatedExtract(
                                 new FieldFromTuple(1), // Tuple2<String[],int[]>[]
@@ -76,6 +74,6 @@ public class ConcatenatedExtractTest {
                         .add(new FieldFromArray(1)); // String
 
         String expected2 = testStringArray2[1];
-        assertEquals(expected2, ext.extract(testData));
+        assertThat(ext.extract(testData)).isEqualTo(expected2);
     }
 }
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldFromArrayTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldFromArrayTest.java
index a3bca1fe1d0..ae6261fad39 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldFromArrayTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldFromArrayTest.java
@@ -17,41 +17,38 @@
 
 package org.apache.flink.streaming.api.functions.windowing.delta.extractor;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertEquals;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /** Tests for {@link FieldFromArray}. */
-public class FieldFromArrayTest {
+class FieldFromArrayTest {
 
     String[] testStringArray = {"0", "1", "2", "3", "4"};
     Integer[] testIntegerArray = {10, 11, 12, 13, 14};
     int[] testIntArray = {20, 21, 22, 23, 24};
 
     @Test
-    public void testStringArray() {
+    void testStringArray() {
         for (int i = 0; i < this.testStringArray.length; i++) {
-            assertEquals(
-                    this.testStringArray[i],
-                    new FieldFromArray<String>(i).extract(testStringArray));
+            assertThat(new FieldFromArray<String>(i).extract(testStringArray))
+                    .isEqualTo(testStringArray[i]);
         }
     }
 
     @Test
-    public void testIntegerArray() {
+    void testIntegerArray() {
         for (int i = 0; i < this.testIntegerArray.length; i++) {
-            assertEquals(
-                    this.testIntegerArray[i],
-                    new FieldFromArray<String>(i).extract(testIntegerArray));
+            assertThat(new FieldFromArray<Integer>(i).extract(testIntegerArray))
+                    .isEqualTo(testIntegerArray[i]);
         }
     }
 
     @Test
-    public void testIntArray() {
+    void testIntArray() {
         for (int i = 0; i < this.testIntArray.length; i++) {
-            assertEquals(
-                    new Integer(this.testIntArray[i]),
-                    new FieldFromArray<Integer>(i).extract(testIntArray));
+            assertThat(new FieldFromArray<Integer>(i).extract(testIntArray))
+                    .isEqualTo(new Integer(testIntArray[i]));
         }
     }
 }
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldFromTupleTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldFromTupleTest.java
index c38fe7a1d07..01e5b7b6111 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldFromTupleTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldFromTupleTest.java
@@ -44,18 +44,18 @@ import org.apache.flink.api.java.tuple.Tuple7;
 import org.apache.flink.api.java.tuple.Tuple8;
 import org.apache.flink.api.java.tuple.Tuple9;
 
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertEquals;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /** Tests for {@link FieldFromTuple}. */
-public class FieldFromTupleTest {
+class FieldFromTupleTest {
 
     private String[] testStrings;
 
-    @Before
-    public void init() {
+    @BeforeEach
+    void init() {
         testStrings = new String[Tuple.MAX_ARITY];
         for (int i = 0; i < Tuple.MAX_ARITY; i++) {
             testStrings[i] = Integer.toString(i);
@@ -63,7 +63,7 @@ public class FieldFromTupleTest {
     }
 
     @Test
-    public void testSingleFieldExtraction() throws InstantiationException, IllegalAccessException {
+    void testSingleFieldExtraction() throws InstantiationException, IllegalAccessException {
         // extract single fields
         for (int i = 0; i < Tuple.MAX_ARITY; i++) {
             Tuple current = (Tuple) CLASSES[i].newInstance();
@@ -71,7 +71,8 @@ public class FieldFromTupleTest {
                 current.setField(testStrings[j], j);
             }
             for (int j = 0; j < i; j++) {
-                assertEquals(testStrings[j], new FieldFromTuple<String>(j).extract(current));
+                assertThat(new FieldFromTuple<String>(j).extract(current))
+                        .isEqualTo(testStrings[j]);
             }
         }
     }
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldsFromArrayTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldsFromArrayTest.java
index 0df8b7f4293..8fb7336835a 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldsFromArrayTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldsFromArrayTest.java
@@ -17,24 +17,24 @@
 
 package org.apache.flink.streaming.api.functions.windowing.delta.extractor;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertEquals;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /** Tests for {@link FieldsFromArray}. */
-public class FieldsFromArrayTest {
+class FieldsFromArrayTest {
 
     String[] testStringArray = {"0", "1", "2", "3", "4"};
     Integer[] testIntegerArray = {10, 11, 12, 13, 14};
     int[] testIntArray = {20, 21, 22, 23, 24};
 
     @Test
-    public void testStringArray() {
+    void testStringArray() {
         // check single field extraction
         for (int i = 0; i < testStringArray.length; i++) {
             String[] tmp = {testStringArray[i]};
             arrayEqualityCheck(
-                    tmp, new FieldsFromArray<String>(String.class, i).extract(testStringArray));
+                    tmp, new FieldsFromArray<>(String.class, i).extract(testStringArray));
         }
 
         // check reverse order
@@ -44,22 +44,21 @@ public class FieldsFromArrayTest {
         }
         arrayEqualityCheck(
                 reverseOrder,
-                new FieldsFromArray<String>(String.class, 4, 3, 2, 1, 0).extract(testStringArray));
+                new FieldsFromArray<>(String.class, 4, 3, 2, 1, 0).extract(testStringArray));
 
         // check picking fields and reorder
         String[] crazyOrder = {testStringArray[4], testStringArray[1], testStringArray[2]};
         arrayEqualityCheck(
-                crazyOrder,
-                new FieldsFromArray<String>(String.class, 4, 1, 2).extract(testStringArray));
+                crazyOrder, new FieldsFromArray<>(String.class, 4, 1, 2).extract(testStringArray));
     }
 
     @Test
-    public void testIntegerArray() {
+    void testIntegerArray() {
         // check single field extraction
         for (int i = 0; i < testIntegerArray.length; i++) {
             Integer[] tmp = {testIntegerArray[i]};
             arrayEqualityCheck(
-                    tmp, new FieldsFromArray<Integer>(Integer.class, i).extract(testIntegerArray));
+                    tmp, new FieldsFromArray<>(Integer.class, i).extract(testIntegerArray));
         }
 
         // check reverse order
@@ -69,22 +68,20 @@ public class FieldsFromArrayTest {
         }
         arrayEqualityCheck(
                 reverseOrder,
-                new FieldsFromArray<Integer>(Integer.class, 4, 3, 2, 1, 0)
-                        .extract(testIntegerArray));
+                new FieldsFromArray<>(Integer.class, 4, 3, 2, 1, 0).extract(testIntegerArray));
 
         // check picking fields and reorder
         Integer[] crazyOrder = {testIntegerArray[4], testIntegerArray[1], testIntegerArray[2]};
         arrayEqualityCheck(
                 crazyOrder,
-                new FieldsFromArray<Integer>(Integer.class, 4, 1, 2).extract(testIntegerArray));
+                new FieldsFromArray<>(Integer.class, 4, 1, 2).extract(testIntegerArray));
     }
 
     @Test
-    public void testIntArray() {
+    void testIntArray() {
         for (int i = 0; i < testIntArray.length; i++) {
             Integer[] tmp = {testIntArray[i]};
-            arrayEqualityCheck(
-                    tmp, new FieldsFromArray<Integer>(Integer.class, i).extract(testIntArray));
+            arrayEqualityCheck(tmp, new FieldsFromArray<>(Integer.class, i).extract(testIntArray));
         }
 
         // check reverse order
@@ -94,19 +91,15 @@ public class FieldsFromArrayTest {
         }
         arrayEqualityCheck(
                 reverseOrder,
-                new FieldsFromArray<Integer>(Integer.class, 4, 3, 2, 1, 0).extract(testIntArray));
+                new FieldsFromArray<>(Integer.class, 4, 3, 2, 1, 0).extract(testIntArray));
 
         // check picking fields and reorder
         Integer[] crazyOrder = {testIntArray[4], testIntArray[1], testIntArray[2]};
         arrayEqualityCheck(
-                crazyOrder,
-                new FieldsFromArray<Integer>(Integer.class, 4, 1, 2).extract(testIntArray));
+                crazyOrder, new FieldsFromArray<>(Integer.class, 4, 1, 2).extract(testIntArray));
     }
 
     private void arrayEqualityCheck(Object[] array1, Object[] array2) {
-        assertEquals("The result arrays must have the same length", array1.length, array2.length);
-        for (int i = 0; i < array1.length; i++) {
-            assertEquals("Unequal fields at position " + i, array1[i], array2[i]);
-        }
+        assertThat(array1).isEqualTo(array2);
     }
 }
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldsFromTupleTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldsFromTupleTest.java
index d99c6326c70..868a8c05f43 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldsFromTupleTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/windowing/delta/extractor/FieldsFromTupleTest.java
@@ -44,18 +44,18 @@ import org.apache.flink.api.java.tuple.Tuple7;
 import org.apache.flink.api.java.tuple.Tuple8;
 import org.apache.flink.api.java.tuple.Tuple9;
 
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertEquals;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /** Tests for {@link FieldsFromTuple}. */
-public class FieldsFromTupleTest {
+class FieldsFromTupleTest {
 
     private double[] testDouble;
 
-    @Before
-    public void init() {
+    @BeforeEach
+    void init() {
         testDouble = new double[Tuple.MAX_ARITY];
         for (int i = 0; i < Tuple.MAX_ARITY; i++) {
             testDouble[i] = i;
@@ -63,7 +63,7 @@ public class FieldsFromTupleTest {
     }
 
     @Test
-    public void testUserSpecifiedOrder() throws InstantiationException, IllegalAccessException {
+    void testUserSpecifiedOrder() throws InstantiationException, IllegalAccessException {
         Tuple currentTuple = (Tuple) CLASSES[Tuple.MAX_ARITY - 1].newInstance();
         for (int i = 0; i < Tuple.MAX_ARITY; i++) {
             currentTuple.setField(testDouble[i], i);
@@ -117,10 +117,7 @@ public class FieldsFromTupleTest {
     }
 
     private void arrayEqualityCheck(double[] array1, double[] array2) {
-        assertEquals("The result arrays must have the same length", array1.length, array2.length);
-        for (int i = 0; i < array1.length; i++) {
-            assertEquals("Unequal fields at position " + i, array1[i], array2[i], 0d);
-        }
+        assertThat(array1).isEqualTo(array2);
     }
 
     private static final Class<?>[] CLASSES =
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/SinkTransformationTranslatorITCaseBase.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/SinkTransformationTranslatorITCaseBase.java
index 3c93b178b51..62157911abe 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/SinkTransformationTranslatorITCaseBase.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/SinkTransformationTranslatorITCaseBase.java
@@ -31,36 +31,34 @@ import org.apache.flink.streaming.api.operators.ChainingStrategy;
 import org.apache.flink.streaming.api.operators.StreamOperatorFactory;
 import org.apache.flink.streaming.runtime.operators.sink.CommitterOperatorFactory;
 import org.apache.flink.streaming.runtime.operators.sink.SinkWriterOperatorFactory;
-import org.apache.flink.util.TestLogger;
+import org.apache.flink.testutils.junit.extensions.parameterized.Parameter;
+import org.apache.flink.testutils.junit.extensions.parameterized.ParameterizedTestExtension;
+import org.apache.flink.testutils.junit.extensions.parameterized.Parameters;
 
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.TestTemplate;
+import org.junit.jupiter.api.extension.ExtendWith;
 
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.function.Predicate;
 
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.MatcherAssert.assertThat;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 /**
  * Tests for {@link org.apache.flink.streaming.api.transformations.SinkTransformation}.
  *
  * <p>ATTENTION: This test is extremely brittle. Do NOT remove, add or re-order test cases.
  */
-@RunWith(Parameterized.class)
-public abstract class SinkTransformationTranslatorITCaseBase<SinkT> extends TestLogger {
+@ExtendWith(ParameterizedTestExtension.class)
+abstract class SinkTransformationTranslatorITCaseBase<SinkT> {
 
-    @Parameterized.Parameters(name = "Execution Mode: {0}")
-    public static Collection<Object> data() {
+    @Parameters(name = "Execution Mode: {0}")
+    private static Collection<Object> data() {
         return Arrays.asList(RuntimeExecutionMode.STREAMING, RuntimeExecutionMode.BATCH);
     }
 
-    @Parameterized.Parameter() public RuntimeExecutionMode runtimeExecutionMode;
+    @Parameter protected RuntimeExecutionMode runtimeExecutionMode;
 
     static final String NAME = "FileSink";
     static final String SLOT_SHARE_GROUP = "FileGroup";
@@ -73,14 +71,14 @@ public abstract class SinkTransformationTranslatorITCaseBase<SinkT> extends Test
 
     abstract DataStreamSink<Integer> sinkTo(DataStream<Integer> stream, SinkT sink);
 
-    @Test
-    public void generateWriterTopology() {
+    @TestTemplate
+    void generateWriterTopology() {
         final StreamGraph streamGraph = buildGraph(simpleSink(), runtimeExecutionMode);
 
         final StreamNode sourceNode = findNodeName(streamGraph, node -> node.contains("Source"));
         final StreamNode writerNode = findWriter(streamGraph);
 
-        assertThat(streamGraph.getStreamNodes().size(), equalTo(2));
+        assertThat(streamGraph.getStreamNodes()).hasSize(2);
 
         validateTopology(
                 sourceNode,
@@ -91,8 +89,8 @@ public abstract class SinkTransformationTranslatorITCaseBase<SinkT> extends Test
                 -1);
     }
 
-    @Test
-    public void generateWriterCommitterTopology() {
+    @TestTemplate
+    void generateWriterCommitterTopology() {
 
         final StreamGraph streamGraph = buildGraph(sinkWithCommitter(), runtimeExecutionMode);
 
@@ -110,7 +108,7 @@ public abstract class SinkTransformationTranslatorITCaseBase<SinkT> extends Test
         final StreamNode committerNode =
                 findNodeName(streamGraph, name -> name.contains("Committer"));
 
-        assertThat(streamGraph.getStreamNodes().size(), equalTo(3));
+        assertThat(streamGraph.getStreamNodes()).hasSize(3);
 
         validateTopology(
                 writerNode,
@@ -136,8 +134,8 @@ public abstract class SinkTransformationTranslatorITCaseBase<SinkT> extends Test
         return findNodeName(streamGraph, name -> name.contains("Global Committer"));
     }
 
-    @Test(expected = IllegalStateException.class)
-    public void throwExceptionWithoutSettingUid() {
+    @TestTemplate
+    void throwExceptionWithoutSettingUid() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         final Configuration config = new Configuration();
@@ -146,11 +144,11 @@ public abstract class SinkTransformationTranslatorITCaseBase<SinkT> extends Test
         // disable auto generating uid
         env.getConfig().disableAutoGeneratedUIDs();
         sinkTo(env.fromElements(1, 2), simpleSink());
-        env.getStreamGraph();
+        assertThatThrownBy(env::getStreamGraph).isInstanceOf(IllegalStateException.class);
     }
 
-    @Test
-    public void disableOperatorChain() {
+    @TestTemplate
+    void disableOperatorChain() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         final DataStreamSource<Integer> src = env.fromElements(1, 2);
@@ -161,9 +159,10 @@ public abstract class SinkTransformationTranslatorITCaseBase<SinkT> extends Test
         final StreamNode writer = findWriter(streamGraph);
         final StreamNode committer = findCommitter(streamGraph);
 
-        assertThat(writer.getOperatorFactory().getChainingStrategy(), is(ChainingStrategy.NEVER));
-        assertThat(
-                committer.getOperatorFactory().getChainingStrategy(), is(ChainingStrategy.NEVER));
+        assertThat(writer.getOperatorFactory().getChainingStrategy())
+                .isEqualTo(ChainingStrategy.NEVER);
+        assertThat(committer.getOperatorFactory().getChainingStrategy())
+                .isEqualTo(ChainingStrategy.NEVER);
     }
 
     void validateTopology(
@@ -176,23 +175,24 @@ public abstract class SinkTransformationTranslatorITCaseBase<SinkT> extends Test
 
         // verify src node
         final StreamEdge srcOutEdge = src.getOutEdges().get(0);
-        assertThat(srcOutEdge.getTargetId(), equalTo(dest.getId()));
-        assertThat(src.getTypeSerializerOut(), instanceOf(srcOutTypeInfo));
+        assertThat(srcOutEdge.getTargetId()).isEqualTo(dest.getId());
+        assertThat(src.getTypeSerializerOut()).isInstanceOf(srcOutTypeInfo);
 
         // verify dest node input
         final StreamEdge destInputEdge = dest.getInEdges().get(0);
-        assertThat(destInputEdge.getSourceId(), equalTo(src.getId()));
-        assertThat(dest.getTypeSerializersIn()[0], instanceOf(srcOutTypeInfo));
+        assertThat(destInputEdge.getTargetId()).isEqualTo(dest.getId());
+        assertThat(dest.getTypeSerializersIn()[0]).isInstanceOf(srcOutTypeInfo);
 
         // make sure 2 sink operators have different names/uid
-        assertThat(dest.getOperatorName(), not(equalTo(src.getOperatorName())));
-        assertThat(dest.getTransformationUID(), not(equalTo(src.getTransformationUID())));
-
-        assertThat(dest.getOperatorFactory(), instanceOf(operatorFactoryClass));
-        assertThat(dest.getParallelism(), equalTo(expectedParallelism));
-        assertThat(dest.getMaxParallelism(), equalTo(expectedMaxParallelism));
-        assertThat(dest.getOperatorFactory().getChainingStrategy(), is(ChainingStrategy.ALWAYS));
-        assertThat(dest.getSlotSharingGroup(), equalTo(SLOT_SHARE_GROUP));
+        assertThat(dest.getOperatorName()).isNotEqualTo(src.getOperatorName());
+        assertThat(dest.getTransformationUID()).isNotEqualTo(src.getTransformationUID());
+
+        assertThat(dest.getOperatorFactory()).isInstanceOf(operatorFactoryClass);
+        assertThat(dest.getParallelism()).isEqualTo(expectedParallelism);
+        assertThat(dest.getMaxParallelism()).isEqualTo(expectedMaxParallelism);
+        assertThat(dest.getOperatorFactory().getChainingStrategy())
+                .isEqualTo(ChainingStrategy.ALWAYS);
+        assertThat(dest.getSlotSharingGroup()).isEqualTo(SLOT_SHARE_GROUP);
     }
 
     StreamGraph buildGraph(SinkT sink, RuntimeExecutionMode runtimeExecutionMode) {
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/SinkV1TransformationTranslatorITCase.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/SinkV1TransformationTranslatorITCase.java
index d1cd770b7fb..8f4ddf77389 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/SinkV1TransformationTranslatorITCase.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/SinkV1TransformationTranslatorITCase.java
@@ -31,22 +31,20 @@ import org.apache.flink.streaming.api.operators.SimpleOperatorFactory;
 import org.apache.flink.streaming.runtime.operators.sink.CommitterOperatorFactory;
 import org.apache.flink.streaming.runtime.operators.sink.SinkWriterOperatorFactory;
 import org.apache.flink.streaming.runtime.operators.sink.TestSink;
+import org.apache.flink.testutils.junit.extensions.parameterized.ParameterizedTestExtension;
 
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.TestTemplate;
+import org.junit.jupiter.api.extension.ExtendWith;
 
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertEquals;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /**
  * Tests for {@link org.apache.flink.streaming.api.transformations.SinkTransformation}.
  *
  * <p>ATTENTION: This test is extremely brittle. Do NOT remove, add or re-order test cases.
  */
-@RunWith(Parameterized.class)
-public class SinkV1TransformationTranslatorITCase
+@ExtendWith(ParameterizedTestExtension.class)
+class SinkV1TransformationTranslatorITCase
         extends SinkTransformationTranslatorITCaseBase<Sink<Integer, ?, ?, ?>> {
 
     @Override
@@ -64,8 +62,8 @@ public class SinkV1TransformationTranslatorITCase
         return stream.sinkTo(sink);
     }
 
-    @Test
-    public void generateWriterCommitterGlobalCommitterTopology() {
+    @TestTemplate
+    void generateWriterCommitterGlobalCommitterTopology() {
 
         final StreamGraph streamGraph =
                 buildGraph(
@@ -90,9 +88,10 @@ public class SinkV1TransformationTranslatorITCase
         StreamNode lastNode;
         if (runtimeExecutionMode == RuntimeExecutionMode.STREAMING) {
             // in streaming writer and committer are merged into one operator
-            assertThat(streamGraph.getStreamNodes().size(), equalTo(4));
+
+            assertThat(streamGraph.getStreamNodes()).hasSize(4);
         } else {
-            assertThat(streamGraph.getStreamNodes().size(), equalTo(4));
+            assertThat(streamGraph.getStreamNodes()).hasSize(4);
             validateTopology(
                     writerNode,
                     SimpleVersionedSerializerTypeSerializerProxy.class,
@@ -118,8 +117,8 @@ public class SinkV1TransformationTranslatorITCase
      * a Global Committer. The SinkV1Adapter translates these topologies into a Sink Writer, an only
      * forwarding committer and the Global Committer.
      */
-    @Test
-    public void generateWriterGlobalCommitterTopology() {
+    @TestTemplate
+    void generateWriterGlobalCommitterTopology() {
         final StreamGraph streamGraph =
                 buildGraph(
                         TestSink.newBuilder()
@@ -162,8 +161,8 @@ public class SinkV1TransformationTranslatorITCase
                 1);
     }
 
-    @Test
-    public void testSettingOperatorUidHash() {
+    @TestTemplate
+    void testSettingOperatorUidHash() {
         final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
         final DataStreamSource<Integer> src = env.fromData(1, 2);
         final String writerHash = "f6b178ce445dc3ffaa06bad27a51fead";
@@ -185,17 +184,17 @@ public class SinkV1TransformationTranslatorITCase
 
         final StreamGraph streamGraph = env.getStreamGraph();
 
-        assertEquals(findWriter(streamGraph).getUserHash(), writerHash);
-        assertEquals(findCommitter(streamGraph).getUserHash(), committerHash);
-        assertEquals(findGlobalCommitter(streamGraph).getUserHash(), globalCommitterHash);
+        assertThat(findWriter(streamGraph).getUserHash()).isEqualTo(writerHash);
+        assertThat(findCommitter(streamGraph).getUserHash()).isEqualTo(committerHash);
+        assertThat(findGlobalCommitter(streamGraph).getUserHash()).isEqualTo(globalCommitterHash);
     }
 
     /**
      * When ever you need to change something in this test case please think about possible state
      * upgrade problems introduced by your changes.
      */
-    @Test
-    public void testSettingOperatorUids() {
+    @TestTemplate
+    void testSettingOperatorUids() {
         final String sinkUid = "f6b178ce445dc3ffaa06bad27a51fead";
         final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
         final DataStreamSource<Integer> src = env.fromData(1, 2);
@@ -204,12 +203,10 @@ public class SinkV1TransformationTranslatorITCase
                 .uid(sinkUid);
 
         final StreamGraph streamGraph = env.getStreamGraph();
-        assertEquals(findWriter(streamGraph).getTransformationUID(), sinkUid);
-        assertEquals(
-                findCommitter(streamGraph).getTransformationUID(),
-                String.format("Sink Committer: %s", sinkUid));
-        assertEquals(
-                findGlobalCommitter(streamGraph).getTransformationUID(),
-                String.format("Sink %s Global Committer", sinkUid));
+        assertThat(findWriter(streamGraph).getTransformationUID()).isEqualTo(sinkUid);
+        assertThat(findCommitter(streamGraph).getTransformationUID())
+                .isEqualTo(String.format("Sink Committer: %s", sinkUid));
+        assertThat(findGlobalCommitter(streamGraph).getTransformationUID())
+                .isEqualTo(String.format("Sink %s Global Committer", sinkUid));
     }
 }
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/SinkV2TransformationTranslatorDeprecatedITCase.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/SinkV2TransformationTranslatorDeprecatedITCase.java
index 9456b4f45a0..20cd837dc27 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/SinkV2TransformationTranslatorDeprecatedITCase.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/SinkV2TransformationTranslatorDeprecatedITCase.java
@@ -25,12 +25,12 @@ import org.apache.flink.streaming.api.datastream.DataStreamSink;
 import org.apache.flink.streaming.api.datastream.DataStreamSource;
 import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
 import org.apache.flink.streaming.runtime.operators.sink.deprecated.TestSinkV2;
+import org.apache.flink.testutils.junit.extensions.parameterized.ParameterizedTestExtension;
 
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.TestTemplate;
+import org.junit.jupiter.api.extension.ExtendWith;
 
-import static org.junit.Assert.assertEquals;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /**
  * Tests for {@link org.apache.flink.streaming.api.transformations.SinkTransformation}.
@@ -41,8 +41,8 @@ import static org.junit.Assert.assertEquals;
  * org.apache.flink.api.connector.sink2.TwoPhaseCommittingSink}.
  */
 @Deprecated
-@RunWith(Parameterized.class)
-public class SinkV2TransformationTranslatorDeprecatedITCase
+@ExtendWith(ParameterizedTestExtension.class)
+class SinkV2TransformationTranslatorDeprecatedITCase
         extends SinkTransformationTranslatorITCaseBase<Sink<Integer>> {
 
     @Override
@@ -60,8 +60,8 @@ public class SinkV2TransformationTranslatorDeprecatedITCase
         return stream.sinkTo(sink);
     }
 
-    @Test
-    public void testSettingOperatorUidHash() {
+    @TestTemplate
+    void testSettingOperatorUidHash() {
         final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
         final DataStreamSource<Integer> src = env.fromElements(1, 2);
         final String writerHash = "f6b178ce445dc3ffaa06bad27a51fead";
@@ -75,25 +75,24 @@ public class SinkV2TransformationTranslatorDeprecatedITCase
 
         final StreamGraph streamGraph = env.getStreamGraph();
 
-        assertEquals(findWriter(streamGraph).getUserHash(), writerHash);
-        assertEquals(findCommitter(streamGraph).getUserHash(), committerHash);
+        assertThat(findWriter(streamGraph).getUserHash()).isEqualTo(writerHash);
+        assertThat(findCommitter(streamGraph).getUserHash()).isEqualTo(committerHash);
     }
 
     /**
      * When ever you need to change something in this test case please think about possible state
      * upgrade problems introduced by your changes.
      */
-    @Test
-    public void testSettingOperatorUids() {
+    @TestTemplate
+    void testSettingOperatorUids() {
         final String sinkUid = "f6b178ce445dc3ffaa06bad27a51fead";
         final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
         final DataStreamSource<Integer> src = env.fromElements(1, 2);
         src.sinkTo(sinkWithCommitter()).name(NAME).uid(sinkUid);
 
         final StreamGraph streamGraph = env.getStreamGraph();
-        assertEquals(findWriter(streamGraph).getTransformationUID(), sinkUid);
-        assertEquals(
-                findCommitter(streamGraph).getTransformationUID(),
-                String.format("Sink Committer: %s", sinkUid));
+        assertThat(findWriter(streamGraph).getTransformationUID()).isEqualTo(sinkUid);
+        assertThat(findCommitter(streamGraph).getTransformationUID())
+                .isEqualTo(String.format("Sink Committer: %s", sinkUid));
     }
 }
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/SinkV2TransformationTranslatorITCase.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/SinkV2TransformationTranslatorITCase.java
index 97b23ababac..6b09b83961d 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/SinkV2TransformationTranslatorITCase.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/SinkV2TransformationTranslatorITCase.java
@@ -25,20 +25,20 @@ import org.apache.flink.streaming.api.datastream.DataStreamSink;
 import org.apache.flink.streaming.api.datastream.DataStreamSource;
 import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
 import org.apache.flink.streaming.runtime.operators.sink.TestSinkV2;
+import org.apache.flink.testutils.junit.extensions.parameterized.ParameterizedTestExtension;
 
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.TestTemplate;
+import org.junit.jupiter.api.extension.ExtendWith;
 
-import static org.junit.Assert.assertEquals;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /**
  * Tests for {@link org.apache.flink.streaming.api.transformations.SinkTransformation}.
  *
  * <p>ATTENTION: This test is extremely brittle. Do NOT remove, add or re-order test cases.
  */
-@RunWith(Parameterized.class)
-public class SinkV2TransformationTranslatorITCase
+@ExtendWith(ParameterizedTestExtension.class)
+class SinkV2TransformationTranslatorITCase
         extends SinkTransformationTranslatorITCaseBase<Sink<Integer>> {
 
     @Override
@@ -56,8 +56,8 @@ public class SinkV2TransformationTranslatorITCase
         return stream.sinkTo(sink);
     }
 
-    @Test
-    public void testSettingOperatorUidHash() {
+    @TestTemplate
+    void testSettingOperatorUidHash() {
         final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
         final DataStreamSource<Integer> src = env.fromElements(1, 2);
         final String writerHash = "f6b178ce445dc3ffaa06bad27a51fead";
@@ -71,25 +71,24 @@ public class SinkV2TransformationTranslatorITCase
 
         final StreamGraph streamGraph = env.getStreamGraph();
 
-        assertEquals(findWriter(streamGraph).getUserHash(), writerHash);
-        assertEquals(findCommitter(streamGraph).getUserHash(), committerHash);
+        assertThat(findWriter(streamGraph).getUserHash()).isEqualTo(writerHash);
+        assertThat(findCommitter(streamGraph).getUserHash()).isEqualTo(committerHash);
     }
 
     /**
      * When ever you need to change something in this test case please think about possible state
      * upgrade problems introduced by your changes.
      */
-    @Test
-    public void testSettingOperatorUids() {
+    @TestTemplate
+    void testSettingOperatorUids() {
         final String sinkUid = "f6b178ce445dc3ffaa06bad27a51fead";
         final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
         final DataStreamSource<Integer> src = env.fromElements(1, 2);
         src.sinkTo(sinkWithCommitter()).name(NAME).uid(sinkUid);
 
         final StreamGraph streamGraph = env.getStreamGraph();
-        assertEquals(findWriter(streamGraph).getTransformationUID(), sinkUid);
-        assertEquals(
-                findCommitter(streamGraph).getTransformationUID(),
-                String.format("Sink Committer: %s", sinkUid));
+        assertThat(findWriter(streamGraph).getTransformationUID()).isEqualTo(sinkUid);
+        assertThat(findCommitter(streamGraph).getTransformationUID())
+                .isEqualTo(String.format("Sink Committer: %s", sinkUid));
     }
 }
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/SlotAllocationTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/SlotAllocationTest.java
index 84a20f50e7c..7fdd7e27083 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/SlotAllocationTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/SlotAllocationTest.java
@@ -23,14 +23,12 @@ import org.apache.flink.runtime.jobgraph.JobVertex;
 import org.apache.flink.streaming.api.datastream.DataStream;
 import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
 import org.apache.flink.streaming.api.functions.co.CoMapFunction;
-import org.apache.flink.util.TestLogger;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import java.util.List;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /**
  * This verifies that slot sharing groups are correctly forwarded from user job to JobGraph.
@@ -39,43 +37,37 @@ import static org.junit.Assert.assertNotEquals;
  * sharing groups.
  */
 @SuppressWarnings("serial")
-public class SlotAllocationTest extends TestLogger {
+class SlotAllocationTest {
+
+    private static final FilterFunction<Long> DUMMY_FILTER = value -> false;
 
     @Test
-    public void testTwoPipelines() {
+    void testTwoPipelines() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
-        FilterFunction<Long> dummyFilter =
-                new FilterFunction<Long>() {
-                    @Override
-                    public boolean filter(Long value) {
-                        return false;
-                    }
-                };
-
         env.fromSequence(1, 10)
-                .filter(dummyFilter)
+                .filter(DUMMY_FILTER)
                 .slotSharingGroup("isolated")
-                .filter(dummyFilter)
+                .filter(DUMMY_FILTER)
                 .slotSharingGroup("default")
                 .disableChaining()
-                .filter(dummyFilter)
+                .filter(DUMMY_FILTER)
                 .slotSharingGroup("group 1")
-                .filter(dummyFilter)
+                .filter(DUMMY_FILTER)
                 .startNewChain()
                 .print()
                 .disableChaining();
 
         // verify that a second pipeline does not inherit the groups from the first pipeline
         env.fromSequence(1, 10)
-                .filter(dummyFilter)
+                .filter(DUMMY_FILTER)
                 .slotSharingGroup("isolated-2")
-                .filter(dummyFilter)
+                .filter(DUMMY_FILTER)
                 .slotSharingGroup("default")
                 .disableChaining()
-                .filter(dummyFilter)
+                .filter(DUMMY_FILTER)
                 .slotSharingGroup("group 2")
-                .filter(dummyFilter)
+                .filter(DUMMY_FILTER)
                 .startNewChain()
                 .print()
                 .disableChaining();
@@ -84,105 +76,87 @@ public class SlotAllocationTest extends TestLogger {
 
         List<JobVertex> vertices = jobGraph.getVerticesSortedTopologicallyFromSources();
 
-        assertEquals(vertices.get(0).getSlotSharingGroup(), vertices.get(3).getSlotSharingGroup());
-        assertNotEquals(
-                vertices.get(0).getSlotSharingGroup(), vertices.get(2).getSlotSharingGroup());
-        assertNotEquals(
-                vertices.get(3).getSlotSharingGroup(), vertices.get(4).getSlotSharingGroup());
-        assertEquals(vertices.get(4).getSlotSharingGroup(), vertices.get(5).getSlotSharingGroup());
-        assertEquals(vertices.get(5).getSlotSharingGroup(), vertices.get(6).getSlotSharingGroup());
+        assertThat(vertices.get(0).getSlotSharingGroup())
+                .isEqualTo(vertices.get(3).getSlotSharingGroup())
+                .isNotEqualTo(vertices.get(2).getSlotSharingGroup());
+        assertThat(vertices.get(3).getSlotSharingGroup())
+                .isNotEqualTo(vertices.get(4).getSlotSharingGroup());
+        assertThat(vertices.get(4).getSlotSharingGroup())
+                .isEqualTo(vertices.get(5).getSlotSharingGroup());
+        assertThat(vertices.get(5).getSlotSharingGroup())
+                .isEqualTo(vertices.get(6).getSlotSharingGroup());
 
         int pipelineStart = 6;
-        assertEquals(
-                vertices.get(1).getSlotSharingGroup(),
-                vertices.get(pipelineStart + 2).getSlotSharingGroup());
-        assertNotEquals(
-                vertices.get(1).getSlotSharingGroup(),
-                vertices.get(pipelineStart + 1).getSlotSharingGroup());
-        assertNotEquals(
-                vertices.get(pipelineStart + 2).getSlotSharingGroup(),
-                vertices.get(pipelineStart + 3).getSlotSharingGroup());
-        assertEquals(
-                vertices.get(pipelineStart + 3).getSlotSharingGroup(),
-                vertices.get(pipelineStart + 4).getSlotSharingGroup());
-        assertEquals(
-                vertices.get(pipelineStart + 4).getSlotSharingGroup(),
-                vertices.get(pipelineStart + 5).getSlotSharingGroup());
+        assertThat(vertices.get(1).getSlotSharingGroup())
+                .isEqualTo(vertices.get(pipelineStart + 2).getSlotSharingGroup())
+                .isNotEqualTo(vertices.get(pipelineStart + 1).getSlotSharingGroup());
+        assertThat(vertices.get(pipelineStart + 2).getSlotSharingGroup())
+                .isNotEqualTo(vertices.get(pipelineStart + 3).getSlotSharingGroup());
+        assertThat(vertices.get(pipelineStart + 3).getSlotSharingGroup())
+                .isEqualTo(vertices.get(pipelineStart + 4).getSlotSharingGroup());
+        assertThat(vertices.get(pipelineStart + 4).getSlotSharingGroup())
+                .isEqualTo(vertices.get(pipelineStart + 5).getSlotSharingGroup());
     }
 
     @Test
-    public void testUnion() {
+    void testUnion() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
-        FilterFunction<Long> dummyFilter =
-                new FilterFunction<Long>() {
-                    @Override
-                    public boolean filter(Long value) {
-                        return false;
-                    }
-                };
-
         DataStream<Long> src1 = env.fromSequence(1, 10);
         DataStream<Long> src2 = env.fromSequence(1, 10).slotSharingGroup("src-1");
 
         // this should not inherit group "src-1"
-        src1.union(src2).filter(dummyFilter);
+        src1.union(src2).filter(DUMMY_FILTER);
 
         DataStream<Long> src3 = env.fromSequence(1, 10).slotSharingGroup("group-1");
         DataStream<Long> src4 = env.fromSequence(1, 10).slotSharingGroup("group-1");
 
         // this should inherit "group-1" now
-        src3.union(src4).filter(dummyFilter);
+        src3.union(src4).filter(DUMMY_FILTER);
 
         JobGraph jobGraph = env.getStreamGraph().getJobGraph();
 
         List<JobVertex> vertices = jobGraph.getVerticesSortedTopologicallyFromSources();
 
         // first pipeline
-        assertEquals(vertices.get(0).getSlotSharingGroup(), vertices.get(4).getSlotSharingGroup());
-        assertNotEquals(
-                vertices.get(0).getSlotSharingGroup(), vertices.get(1).getSlotSharingGroup());
-        assertNotEquals(
-                vertices.get(1).getSlotSharingGroup(), vertices.get(4).getSlotSharingGroup());
+        assertThat(vertices.get(0).getSlotSharingGroup())
+                .isEqualTo(vertices.get(4).getSlotSharingGroup())
+                .isNotEqualTo(vertices.get(1).getSlotSharingGroup());
+        assertThat(vertices.get(1).getSlotSharingGroup())
+                .isNotEqualTo(vertices.get(4).getSlotSharingGroup());
 
         // second pipeline
-        assertEquals(vertices.get(2).getSlotSharingGroup(), vertices.get(3).getSlotSharingGroup());
-        assertEquals(vertices.get(2).getSlotSharingGroup(), vertices.get(5).getSlotSharingGroup());
-        assertEquals(vertices.get(3).getSlotSharingGroup(), vertices.get(5).getSlotSharingGroup());
+        assertThat(vertices.get(2).getSlotSharingGroup())
+                .isEqualTo(vertices.get(3).getSlotSharingGroup())
+                .isEqualTo(vertices.get(5).getSlotSharingGroup());
+        assertThat(vertices.get(3).getSlotSharingGroup())
+                .isEqualTo(vertices.get(5).getSlotSharingGroup());
     }
 
     @Test
-    public void testInheritOverride() {
+    void testInheritOverride() {
         // verify that we can explicitly disable inheritance of the input slot sharing groups
 
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
-        FilterFunction<Long> dummyFilter =
-                new FilterFunction<Long>() {
-                    @Override
-                    public boolean filter(Long value) {
-                        return false;
-                    }
-                };
-
         DataStream<Long> src1 = env.fromSequence(1, 10).slotSharingGroup("group-1");
         DataStream<Long> src2 = env.fromSequence(1, 10).slotSharingGroup("group-1");
 
         // this should not inherit group but be in "default"
-        src1.union(src2).filter(dummyFilter).slotSharingGroup("default");
+        src1.union(src2).filter(DUMMY_FILTER).slotSharingGroup("default");
         JobGraph jobGraph = env.getStreamGraph().getJobGraph();
 
         List<JobVertex> vertices = jobGraph.getVerticesSortedTopologicallyFromSources();
 
-        assertEquals(vertices.get(0).getSlotSharingGroup(), vertices.get(1).getSlotSharingGroup());
-        assertNotEquals(
-                vertices.get(0).getSlotSharingGroup(), vertices.get(2).getSlotSharingGroup());
-        assertNotEquals(
-                vertices.get(1).getSlotSharingGroup(), vertices.get(2).getSlotSharingGroup());
+        assertThat(vertices.get(0).getSlotSharingGroup())
+                .isEqualTo(vertices.get(1).getSlotSharingGroup())
+                .isNotEqualTo(vertices.get(2).getSlotSharingGroup());
+        assertThat(vertices.get(1).getSlotSharingGroup())
+                .isNotEqualTo(vertices.get(2).getSlotSharingGroup());
     }
 
     @Test
-    public void testCoOperation() {
+    void testCoOperation() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         CoMapFunction<Long, Long, Long> dummyCoMap =
@@ -215,15 +189,17 @@ public class SlotAllocationTest extends TestLogger {
         List<JobVertex> vertices = jobGraph.getVerticesSortedTopologicallyFromSources();
 
         // first pipeline
-        assertEquals(vertices.get(0).getSlotSharingGroup(), vertices.get(4).getSlotSharingGroup());
-        assertNotEquals(
-                vertices.get(0).getSlotSharingGroup(), vertices.get(1).getSlotSharingGroup());
-        assertNotEquals(
-                vertices.get(1).getSlotSharingGroup(), vertices.get(4).getSlotSharingGroup());
+        assertThat(vertices.get(0).getSlotSharingGroup())
+                .isEqualTo(vertices.get(4).getSlotSharingGroup())
+                .isNotEqualTo(vertices.get(1).getSlotSharingGroup());
+        assertThat(vertices.get(1).getSlotSharingGroup())
+                .isNotEqualTo(vertices.get(4).getSlotSharingGroup());
 
         // second pipeline
-        assertEquals(vertices.get(2).getSlotSharingGroup(), vertices.get(3).getSlotSharingGroup());
-        assertEquals(vertices.get(2).getSlotSharingGroup(), vertices.get(5).getSlotSharingGroup());
-        assertEquals(vertices.get(3).getSlotSharingGroup(), vertices.get(5).getSlotSharingGroup());
+        assertThat(vertices.get(2).getSlotSharingGroup())
+                .isEqualTo(vertices.get(3).getSlotSharingGroup())
+                .isEqualTo(vertices.get(5).getSlotSharingGroup());
+        assertThat(vertices.get(3).getSlotSharingGroup())
+                .isEqualTo(vertices.get(5).getSlotSharingGroup());
     }
 }
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamGraphGeneratorBatchExecutionTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamGraphGeneratorBatchExecutionTest.java
index ab64dcc7405..5dc5fc4de14 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamGraphGeneratorBatchExecutionTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamGraphGeneratorBatchExecutionTest.java
@@ -60,11 +60,8 @@ import org.apache.flink.streaming.api.transformations.KeyedMultipleInputTransfor
 import org.apache.flink.streaming.api.transformations.SourceTransformation;
 import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
 import org.apache.flink.util.Collector;
-import org.apache.flink.util.TestLogger;
 
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -72,24 +69,17 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.notNullValue;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertEquals;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 /**
  * Tests for generating correct properties for sorting inputs in {@link RuntimeExecutionMode#BATCH}
  * runtime mode.
  */
-public class StreamGraphGeneratorBatchExecutionTest extends TestLogger {
-
-    @Rule public ExpectedException expectedException = ExpectedException.none();
+class StreamGraphGeneratorBatchExecutionTest {
 
     @Test
-    public void testShuffleMode() {
+    void testShuffleMode() {
         testGlobalStreamExchangeMode(
                 RuntimeExecutionMode.AUTOMATIC,
                 BatchShuffleMode.ALL_EXCHANGES_BLOCKING,
@@ -117,18 +107,18 @@ public class StreamGraphGeneratorBatchExecutionTest extends TestLogger {
     }
 
     @Test
-    public void testBatchJobType() {
+    void testBatchJobType() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         DataStreamSink<Integer> sink = addDummyPipeline(env);
 
         StreamGraph graph = getStreamGraphInBatchMode(sink);
 
-        assertThat(graph.getJobType(), is(JobType.BATCH));
+        assertThat(graph.getJobType()).isEqualTo(JobType.BATCH);
     }
 
     @Test
-    public void testManagedMemoryWeights() {
+    void testManagedMemoryWeights() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         SingleOutputStreamOperator<Integer> process =
@@ -142,16 +132,14 @@ public class StreamGraphGeneratorBatchExecutionTest extends TestLogger {
         expectedOperatorWeights.put(
                 ManagedMemoryUseCase.OPERATOR,
                 ExecutionOptions.SORTED_INPUTS_MEMORY.defaultValue().getMebiBytes());
-        assertThat(
-                processNode.getManagedMemoryOperatorScopeUseCaseWeights(),
-                equalTo(expectedOperatorWeights));
-        assertThat(
-                processNode.getManagedMemorySlotScopeUseCases(),
-                equalTo(Collections.singleton(ManagedMemoryUseCase.STATE_BACKEND)));
+        assertThat(processNode.getManagedMemoryOperatorScopeUseCaseWeights())
+                .isEqualTo(expectedOperatorWeights);
+        assertThat(processNode.getManagedMemorySlotScopeUseCases())
+                .containsOnly(ManagedMemoryUseCase.STATE_BACKEND);
     }
 
     @Test
-    public void testCustomManagedMemoryWeights() {
+    void testCustomManagedMemoryWeights() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
         SingleOutputStreamOperator<Integer> process =
                 env.fromData(1, 2).keyBy(Integer::intValue).process(DUMMY_PROCESS_FUNCTION);
@@ -165,16 +153,14 @@ public class StreamGraphGeneratorBatchExecutionTest extends TestLogger {
 
         final Map<ManagedMemoryUseCase, Integer> expectedOperatorWeights = new HashMap<>();
         expectedOperatorWeights.put(ManagedMemoryUseCase.OPERATOR, 42);
-        assertThat(
-                processNode.getManagedMemoryOperatorScopeUseCaseWeights(),
-                equalTo(expectedOperatorWeights));
-        assertThat(
-                processNode.getManagedMemorySlotScopeUseCases(),
-                equalTo(Collections.singleton(ManagedMemoryUseCase.STATE_BACKEND)));
+        assertThat(processNode.getManagedMemoryOperatorScopeUseCaseWeights())
+                .isEqualTo(expectedOperatorWeights);
+        assertThat(processNode.getManagedMemorySlotScopeUseCases())
+                .containsOnly(ManagedMemoryUseCase.STATE_BACKEND);
     }
 
     @Test
-    public void testOneInputTransformation() {
+    void testOneInputTransformation() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         SingleOutputStreamOperator<Integer> process =
@@ -184,19 +170,17 @@ public class StreamGraphGeneratorBatchExecutionTest extends TestLogger {
         StreamGraph graph = getStreamGraphInBatchMode(sink);
 
         StreamNode processNode = graph.getStreamNode(process.getId());
-        assertThat(
-                processNode.getInputRequirements().get(0),
-                equalTo(StreamConfig.InputRequirement.SORTED));
-        assertThat(
-                processNode.getOperatorFactory().getChainingStrategy(),
-                equalTo(ChainingStrategy.HEAD));
-        assertThat(graph.getStateBackend(), instanceOf(BatchExecutionStateBackend.class));
+        assertThat(processNode.getInputRequirements().get(0))
+                .isEqualTo(StreamConfig.InputRequirement.SORTED);
+        assertThat(processNode.getOperatorFactory().getChainingStrategy())
+                .isEqualTo(ChainingStrategy.HEAD);
+        assertThat(graph.getStateBackend()).isInstanceOf(BatchExecutionStateBackend.class);
         // the provider is passed as a lambda therefore we cannot assert the class of the provider
-        assertThat(graph.getTimerServiceProvider(), notNullValue());
+        assertThat(graph.getTimerServiceProvider()).isNotNull();
     }
 
     @Test
-    public void testDisablingStateBackendOneInputTransformation() {
+    void testDisablingStateBackendOneInputTransformation() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         SingleOutputStreamOperator<Integer> process =
@@ -209,18 +193,16 @@ public class StreamGraphGeneratorBatchExecutionTest extends TestLogger {
         StreamGraph graph = getStreamGraphInBatchMode(sink, configuration);
 
         StreamNode processNode = graph.getStreamNode(process.getId());
-        assertThat(
-                processNode.getInputRequirements().get(0),
-                equalTo(StreamConfig.InputRequirement.SORTED));
-        assertThat(
-                processNode.getOperatorFactory().getChainingStrategy(),
-                equalTo(ChainingStrategy.HEAD));
-        assertThat(graph.getStateBackend(), nullValue());
-        assertThat(graph.getTimerServiceProvider(), nullValue());
+        assertThat(processNode.getInputRequirements().get(0))
+                .isEqualTo(StreamConfig.InputRequirement.SORTED);
+        assertThat(processNode.getOperatorFactory().getChainingStrategy())
+                .isEqualTo(ChainingStrategy.HEAD);
+        assertThat(graph.getStateBackend()).isNull();
+        assertThat(graph.getTimerServiceProvider()).isNull();
     }
 
     @Test
-    public void testDisablingSortingInputsOneInputTransformation() {
+    void testDisablingSortingInputsOneInputTransformation() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         SingleOutputStreamOperator<Integer> process =
@@ -234,13 +216,13 @@ public class StreamGraphGeneratorBatchExecutionTest extends TestLogger {
         StreamGraph graph = getStreamGraphInBatchMode(sink, configuration);
 
         StreamNode processNode = graph.getStreamNode(process.getId());
-        assertThat(processNode.getInputRequirements().get(0), nullValue());
-        assertThat(graph.getStateBackend(), nullValue());
-        assertThat(graph.getTimerServiceProvider(), nullValue());
+        assertThat(processNode.getInputRequirements().get(0)).isNull();
+        assertThat(graph.getStateBackend()).isNull();
+        assertThat(graph.getTimerServiceProvider()).isNull();
     }
 
     @Test
-    public void testDisablingSortingInputsWithoutBatchStateBackendOneInputTransformation() {
+    void testDisablingSortingInputsWithoutBatchStateBackendOneInputTransformation() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         SingleOutputStreamOperator<Integer> process =
@@ -250,14 +232,14 @@ public class StreamGraphGeneratorBatchExecutionTest extends TestLogger {
         Configuration configuration = new Configuration();
         configuration.set(ExecutionOptions.SORT_INPUTS, false);
 
-        expectedException.expect(IllegalStateException.class);
-        expectedException.expectMessage(
-                "Batch state backend requires the sorted inputs to be enabled!");
-        getStreamGraphInBatchMode(sink, configuration);
+        assertThatThrownBy(() -> getStreamGraphInBatchMode(sink, configuration))
+                .isInstanceOf(IllegalStateException.class)
+                .hasMessageContaining(
+                        "Batch state backend requires the sorted inputs to be enabled!");
     }
 
     @Test
-    public void testTwoInputTransformation() {
+    void testTwoInputTransformation() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         DataStreamSource<Integer> elements1 = env.fromData(1, 2);
@@ -272,22 +254,19 @@ public class StreamGraphGeneratorBatchExecutionTest extends TestLogger {
         StreamGraph graph = getStreamGraphInBatchMode(sink);
 
         StreamNode processNode = graph.getStreamNode(process.getId());
-        assertThat(
-                processNode.getInputRequirements().get(0),
-                equalTo(StreamConfig.InputRequirement.SORTED));
-        assertThat(
-                processNode.getInputRequirements().get(1),
-                equalTo(StreamConfig.InputRequirement.SORTED));
-        assertThat(
-                processNode.getOperatorFactory().getChainingStrategy(),
-                equalTo(ChainingStrategy.HEAD));
-        assertThat(graph.getStateBackend(), instanceOf(BatchExecutionStateBackend.class));
+        assertThat(processNode.getInputRequirements().get(0))
+                .isEqualTo(StreamConfig.InputRequirement.SORTED);
+        assertThat(processNode.getInputRequirements().get(1))
+                .isEqualTo(StreamConfig.InputRequirement.SORTED);
+        assertThat(processNode.getOperatorFactory().getChainingStrategy())
+                .isEqualTo(ChainingStrategy.HEAD);
+        assertThat(graph.getStateBackend()).isInstanceOf(BatchExecutionStateBackend.class);
         // the provider is passed as a lambda therefore we cannot assert the class of the provider
-        assertThat(graph.getTimerServiceProvider(), notNullValue());
+        assertThat(graph.getTimerServiceProvider()).isNotNull();
     }
 
     @Test
-    public void testDisablingStateBackendTwoInputTransformation() {
+    void testDisablingStateBackendTwoInputTransformation() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         DataStreamSource<Integer> elements1 = env.fromData(1, 2);
@@ -305,21 +284,18 @@ public class StreamGraphGeneratorBatchExecutionTest extends TestLogger {
         StreamGraph graph = getStreamGraphInBatchMode(sink, configuration);
 
         StreamNode processNode = graph.getStreamNode(process.getId());
-        assertThat(
-                processNode.getInputRequirements().get(0),
-                equalTo(StreamConfig.InputRequirement.SORTED));
-        assertThat(
-                processNode.getInputRequirements().get(1),
-                equalTo(StreamConfig.InputRequirement.SORTED));
-        assertThat(
-                processNode.getOperatorFactory().getChainingStrategy(),
-                equalTo(ChainingStrategy.HEAD));
-        assertThat(graph.getStateBackend(), nullValue());
-        assertThat(graph.getTimerServiceProvider(), nullValue());
+        assertThat(processNode.getInputRequirements().get(0))
+                .isEqualTo(StreamConfig.InputRequirement.SORTED);
+        assertThat(processNode.getInputRequirements().get(1))
+                .isEqualTo(StreamConfig.InputRequirement.SORTED);
+        assertThat(processNode.getOperatorFactory().getChainingStrategy())
+                .isEqualTo(ChainingStrategy.HEAD);
+        assertThat(graph.getStateBackend()).isNull();
+        assertThat(graph.getTimerServiceProvider()).isNull();
     }
 
     @Test
-    public void testDisablingSortingInputsTwoInputTransformation() {
+    void testDisablingSortingInputsTwoInputTransformation() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         DataStreamSource<Integer> elements1 = env.fromData(1, 2);
@@ -338,14 +314,14 @@ public class StreamGraphGeneratorBatchExecutionTest extends TestLogger {
         StreamGraph graph = getStreamGraphInBatchMode(sink, configuration);
 
         StreamNode processNode = graph.getStreamNode(process.getId());
-        assertThat(processNode.getInputRequirements().get(0), nullValue());
-        assertThat(processNode.getInputRequirements().get(1), nullValue());
-        assertThat(graph.getStateBackend(), nullValue());
-        assertThat(graph.getTimerServiceProvider(), nullValue());
+        assertThat(processNode.getInputRequirements().get(0)).isNull();
+        assertThat(processNode.getInputRequirements().get(1)).isNull();
+        assertThat(graph.getStateBackend()).isNull();
+        assertThat(graph.getTimerServiceProvider()).isNull();
     }
 
     @Test
-    public void testDisablingSortingInputsWithoutBatchStateBackendTwoInputTransformation() {
+    void testDisablingSortingInputsWithoutBatchStateBackendTwoInputTransformation() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         DataStreamSource<Integer> elements1 = env.fromData(1, 2);
@@ -360,14 +336,14 @@ public class StreamGraphGeneratorBatchExecutionTest extends TestLogger {
         Configuration configuration = new Configuration();
         configuration.set(ExecutionOptions.SORT_INPUTS, false);
 
-        expectedException.expect(IllegalStateException.class);
-        expectedException.expectMessage(
-                "Batch state backend requires the sorted inputs to be enabled!");
-        getStreamGraphInBatchMode(sink, configuration);
+        assertThatThrownBy(() -> getStreamGraphInBatchMode(sink, configuration))
+                .isInstanceOf(IllegalStateException.class)
+                .hasMessageContaining(
+                        "Batch state backend requires the sorted inputs to be enabled!");
     }
 
     @Test
-    public void testInputSelectableTwoInputTransformation() {
+    void testInputSelectableTwoInputTransformation() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         DataStreamSource<Integer> elements1 = env.fromData(1, 2);
@@ -388,14 +364,14 @@ public class StreamGraphGeneratorBatchExecutionTest extends TestLogger {
 
         DataStreamSink<Integer> sink = selectableOperator.sinkTo(new DiscardingSink<>());
 
-        expectedException.expect(IllegalStateException.class);
-        expectedException.expectMessage(
-                "Batch state backend and sorting inputs are not supported in graphs with an InputSelectable operator.");
-        getStreamGraphInBatchMode(sink);
+        assertThatThrownBy(() -> getStreamGraphInBatchMode(sink))
+                .isInstanceOf(IllegalStateException.class)
+                .hasMessageContaining(
+                        "Batch state backend and sorting inputs are not supported in graphs with an InputSelectable operator.");
     }
 
     @Test
-    public void testMultiInputTransformation() {
+    void testMultiInputTransformation() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         DataStreamSource<Integer> elements1 = env.fromData(1, 2);
@@ -423,22 +399,19 @@ public class StreamGraphGeneratorBatchExecutionTest extends TestLogger {
         StreamGraph graph = getStreamGraphInBatchMode(sink);
 
         StreamNode operatorNode = graph.getStreamNode(multipleInputTransformation.getId());
-        assertThat(
-                operatorNode.getInputRequirements().get(0),
-                equalTo(StreamConfig.InputRequirement.SORTED));
-        assertThat(
-                operatorNode.getInputRequirements().get(1),
-                equalTo(StreamConfig.InputRequirement.SORTED));
-        assertThat(
-                operatorNode.getOperatorFactory().getChainingStrategy(),
-                equalTo(ChainingStrategy.HEAD));
-        assertThat(graph.getStateBackend(), instanceOf(BatchExecutionStateBackend.class));
+        assertThat(operatorNode.getInputRequirements().get(0))
+                .isEqualTo(StreamConfig.InputRequirement.SORTED);
+        assertThat(operatorNode.getInputRequirements().get(1))
+                .isEqualTo(StreamConfig.InputRequirement.SORTED);
+        assertThat(operatorNode.getOperatorFactory().getChainingStrategy())
+                .isEqualTo(ChainingStrategy.HEAD);
+        assertThat(graph.getStateBackend()).isInstanceOf(BatchExecutionStateBackend.class);
         // the provider is passed as a lambda therefore we cannot assert the class of the provider
-        assertThat(graph.getTimerServiceProvider(), notNullValue());
+        assertThat(graph.getTimerServiceProvider()).isNotNull();
     }
 
     @Test
-    public void testInputSelectableMultiInputTransformation() {
+    void testInputSelectableMultiInputTransformation() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         DataStreamSource<Integer> elements1 = env.fromData(1, 2);
@@ -462,14 +435,14 @@ public class StreamGraphGeneratorBatchExecutionTest extends TestLogger {
                         .transform(multipleInputTransformation)
                         .sinkTo(new DiscardingSink<>());
 
-        expectedException.expect(IllegalStateException.class);
-        expectedException.expectMessage(
-                "Batch state backend and sorting inputs are not supported in graphs with an InputSelectable operator.");
-        getStreamGraphInBatchMode(sink);
+        assertThatThrownBy(() -> getStreamGraphInBatchMode(sink))
+                .isInstanceOf(IllegalStateException.class)
+                .hasMessageContaining(
+                        "Batch state backend and sorting inputs are not supported in graphs with an InputSelectable operator.");
     }
 
     @Test
-    public void testFeedbackThrowsExceptionInBatch() {
+    void testFeedbackThrowsExceptionInBatch() {
         final SourceTransformation<Integer, ?, ?> bounded =
                 new SourceTransformation<>(
                         "Bounded Source",
@@ -485,7 +458,7 @@ public class StreamGraphGeneratorBatchExecutionTest extends TestLogger {
     }
 
     @Test
-    public void testCoFeedbackThrowsExceptionInBatch() {
+    void testCoFeedbackThrowsExceptionInBatch() {
         final CoFeedbackTransformation<Integer> coFeedbackTransformation =
                 new CoFeedbackTransformation<>(2, TypeInformation.of(Integer.TYPE), 5L);
         testNoSupportForIterationsInBatchHelper(coFeedbackTransformation);
@@ -506,9 +479,9 @@ public class StreamGraphGeneratorBatchExecutionTest extends TestLogger {
                         new CheckpointConfig(),
                         configuration);
 
-        expectedException.expect(UnsupportedOperationException.class);
-        expectedException.expectMessage("Iterations are not supported in BATCH execution mode.");
-        streamGraphGenerator.generate();
+        assertThatThrownBy(streamGraphGenerator::generate)
+                .isInstanceOf(UnsupportedOperationException.class)
+                .hasMessageContaining("Iterations are not supported in BATCH execution mode.");
     }
 
     private void testGlobalStreamExchangeMode(
@@ -532,7 +505,7 @@ public class StreamGraphGeneratorBatchExecutionTest extends TestLogger {
 
         StreamGraph graph = streamGraphGenerator.generate();
 
-        assertEquals(expectedStreamExchangeMode, graph.getGlobalStreamExchangeMode());
+        assertThat(graph.getGlobalStreamExchangeMode()).isEqualTo(expectedStreamExchangeMode);
     }
 
     private DataStreamSink<Integer> addDummyPipeline(StreamExecutionEnvironment env) {
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamGraphGeneratorExecutionModeDetectionTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamGraphGeneratorExecutionModeDetectionTest.java
index c95f22738db..ff06b12d462 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamGraphGeneratorExecutionModeDetectionTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamGraphGeneratorExecutionModeDetectionTest.java
@@ -34,34 +34,27 @@ import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
 import org.apache.flink.streaming.api.operators.SimpleOperatorFactory;
 import org.apache.flink.streaming.api.transformations.SourceTransformation;
 import org.apache.flink.streaming.api.transformations.TwoInputTransformation;
-import org.apache.flink.util.TestLogger;
 
 import org.hamcrest.Description;
 import org.hamcrest.TypeSafeMatcher;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
 
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.assertj.core.api.HamcrestCondition.matching;
 
 /**
  * Tests for the detection of the {@link RuntimeExecutionMode runtime execution mode} during stream
  * graph translation.
  */
-public class StreamGraphGeneratorExecutionModeDetectionTest extends TestLogger {
-
-    @Rule public ExpectedException thrown = ExpectedException.none();
+class StreamGraphGeneratorExecutionModeDetectionTest {
 
     @Test
-    public void testExecutionModePropagationFromEnvWithDefaultAndBoundedSource() {
+    void testExecutionModePropagationFromEnvWithDefaultAndBoundedSource() {
         final StreamExecutionEnvironment environment =
                 StreamExecutionEnvironment.getExecutionEnvironment();
         environment.enableCheckpointing(100);
@@ -73,17 +66,18 @@ public class StreamGraphGeneratorExecutionModeDetectionTest extends TestLogger {
                         "bounded-source")
                 .print();
 
-        assertThat(
-                environment.getStreamGraph(),
-                hasProperties(
-                        GlobalStreamExchangeMode.ALL_EDGES_PIPELINED,
-                        JobType.STREAMING,
-                        true,
-                        true));
+        assertThat(environment.getStreamGraph())
+                .is(
+                        matching(
+                                hasProperties(
+                                        GlobalStreamExchangeMode.ALL_EDGES_PIPELINED,
+                                        JobType.STREAMING,
+                                        true,
+                                        true)));
     }
 
     @Test
-    public void testExecutionModePropagationFromEnvWithDefaultAndUnboundedSource() {
+    void testExecutionModePropagationFromEnvWithDefaultAndUnboundedSource() {
         final StreamExecutionEnvironment environment =
                 StreamExecutionEnvironment.getExecutionEnvironment();
 
@@ -94,17 +88,18 @@ public class StreamGraphGeneratorExecutionModeDetectionTest extends TestLogger {
                         "unbounded-source")
                 .print();
 
-        assertThat(
-                environment.getStreamGraph(),
-                hasProperties(
-                        GlobalStreamExchangeMode.ALL_EDGES_PIPELINED,
-                        JobType.STREAMING,
-                        false,
-                        true));
+        assertThat(environment.getStreamGraph())
+                .is(
+                        matching(
+                                hasProperties(
+                                        GlobalStreamExchangeMode.ALL_EDGES_PIPELINED,
+                                        JobType.STREAMING,
+                                        false,
+                                        true)));
     }
 
     @Test
-    public void testExecutionModePropagationFromEnvWithAutomaticAndBoundedSource() {
+    void testExecutionModePropagationFromEnvWithAutomaticAndBoundedSource() {
         final Configuration config = new Configuration();
         config.set(ExecutionOptions.RUNTIME_MODE, RuntimeExecutionMode.AUTOMATIC);
 
@@ -120,18 +115,22 @@ public class StreamGraphGeneratorExecutionModeDetectionTest extends TestLogger {
                         "bounded-source")
                 .print();
 
-        assertTrue(environment.isChainingEnabled());
-        assertThat(environment.getCheckpointInterval(), is(equalTo(100L)));
+        assertThat(environment.isChainingEnabled()).isTrue();
+        assertThat(environment.getCheckpointInterval()).isEqualTo(100L);
 
         final StreamGraph streamGraph = environment.getStreamGraph();
-        assertThat(
-                streamGraph,
-                hasProperties(
-                        GlobalStreamExchangeMode.ALL_EDGES_BLOCKING, JobType.BATCH, false, false));
+        assertThat(streamGraph)
+                .is(
+                        matching(
+                                hasProperties(
+                                        GlobalStreamExchangeMode.ALL_EDGES_BLOCKING,
+                                        JobType.BATCH,
+                                        false,
+                                        false)));
     }
 
     @Test
-    public void testExecutionModePropagationFromEnvWithBatchAndUnboundedSource() {
+    void testExecutionModePropagationFromEnvWithBatchAndUnboundedSource() {
         final Configuration config = new Configuration();
         config.set(ExecutionOptions.RUNTIME_MODE, RuntimeExecutionMode.BATCH);
 
@@ -146,20 +145,20 @@ public class StreamGraphGeneratorExecutionModeDetectionTest extends TestLogger {
                         "unbounded-source")
                 .print();
 
-        thrown.expect(IllegalStateException.class);
-        thrown.expectMessage("combination is not allowed");
-        environment.getStreamGraph();
+        assertThatThrownBy(environment::getStreamGraph)
+                .isInstanceOf(IllegalStateException.class)
+                .hasMessageContaining("combination is not allowed");
     }
 
     @Test
-    public void testDetectionThroughTransitivePredecessors() {
+    void testDetectionThroughTransitivePredecessors() {
         final SourceTransformation<Integer, ?, ?> bounded =
                 getSourceTransformation("Bounded Source", Boundedness.BOUNDED);
-        assertEquals(Boundedness.BOUNDED, bounded.getBoundedness());
+        assertThat(bounded.getBoundedness()).isEqualTo(Boundedness.BOUNDED);
 
         final SourceTransformation<Integer, ?, ?> unbounded =
                 getSourceTransformation("Unbounded Source", Boundedness.CONTINUOUS_UNBOUNDED);
-        assertEquals(Boundedness.CONTINUOUS_UNBOUNDED, unbounded.getBoundedness());
+        assertThat(unbounded.getBoundedness()).isEqualTo(Boundedness.CONTINUOUS_UNBOUNDED);
 
         final TwoInputTransformation<Integer, Integer, Integer> resultTransform =
                 new TwoInputTransformation<>(
@@ -174,85 +173,97 @@ public class StreamGraphGeneratorExecutionModeDetectionTest extends TestLogger {
 
         final StreamGraph graph =
                 generateStreamGraph(RuntimeExecutionMode.AUTOMATIC, resultTransform);
-        assertThat(
-                graph,
-                hasProperties(
-                        GlobalStreamExchangeMode.ALL_EDGES_PIPELINED,
-                        JobType.STREAMING,
-                        false,
-                        true));
+        assertThat(graph)
+                .is(
+                        matching(
+                                hasProperties(
+                                        GlobalStreamExchangeMode.ALL_EDGES_PIPELINED,
+                                        JobType.STREAMING,
+                                        false,
+                                        true)));
     }
 
     @Test
-    public void testBoundedDetection() {
+    void testBoundedDetection() {
         final SourceTransformation<Integer, ?, ?> bounded =
                 getSourceTransformation("Bounded Source", Boundedness.BOUNDED);
-        assertEquals(Boundedness.BOUNDED, bounded.getBoundedness());
+        assertThat(bounded.getBoundedness()).isEqualTo(Boundedness.BOUNDED);
 
         final StreamGraph graph = generateStreamGraph(RuntimeExecutionMode.AUTOMATIC, bounded);
-        assertThat(
-                graph,
-                hasProperties(
-                        GlobalStreamExchangeMode.ALL_EDGES_BLOCKING, JobType.BATCH, false, false));
+        assertThat(graph)
+                .is(
+                        matching(
+                                hasProperties(
+                                        GlobalStreamExchangeMode.ALL_EDGES_BLOCKING,
+                                        JobType.BATCH,
+                                        false,
+                                        false)));
     }
 
     @Test
-    public void testUnboundedDetection() {
+    void testUnboundedDetection() {
         final SourceTransformation<Integer, ?, ?> unbounded =
                 getSourceTransformation("Unbounded Source", Boundedness.CONTINUOUS_UNBOUNDED);
-        assertEquals(Boundedness.CONTINUOUS_UNBOUNDED, unbounded.getBoundedness());
+        assertThat(unbounded.getBoundedness()).isEqualTo(Boundedness.CONTINUOUS_UNBOUNDED);
 
         final StreamGraph graph = generateStreamGraph(RuntimeExecutionMode.AUTOMATIC, unbounded);
-        assertThat(
-                graph,
-                hasProperties(
-                        GlobalStreamExchangeMode.ALL_EDGES_PIPELINED,
-                        JobType.STREAMING,
-                        false,
-                        true));
+        assertThat(graph)
+                .is(
+                        matching(
+                                hasProperties(
+                                        GlobalStreamExchangeMode.ALL_EDGES_PIPELINED,
+                                        JobType.STREAMING,
+                                        false,
+                                        true)));
     }
 
     @Test
-    public void testMixedDetection() {
+    void testMixedDetection() {
         final SourceTransformation<Integer, ?, ?> unbounded =
                 getSourceTransformation("Unbounded Source", Boundedness.CONTINUOUS_UNBOUNDED);
-        assertEquals(Boundedness.CONTINUOUS_UNBOUNDED, unbounded.getBoundedness());
+        assertThat(unbounded.getBoundedness()).isEqualTo(Boundedness.CONTINUOUS_UNBOUNDED);
 
         final SourceTransformation<Integer, ?, ?> bounded =
                 getSourceTransformation("Bounded Source", Boundedness.BOUNDED);
-        assertEquals(Boundedness.BOUNDED, bounded.getBoundedness());
+        assertThat(bounded.getBoundedness()).isEqualTo(Boundedness.BOUNDED);
 
         final StreamGraph graph = generateStreamGraph(RuntimeExecutionMode.AUTOMATIC, unbounded);
-        assertThat(
-                graph,
-                hasProperties(
-                        GlobalStreamExchangeMode.ALL_EDGES_PIPELINED,
-                        JobType.STREAMING,
-                        false,
-                        true));
+        assertThat(graph)
+                .is(
+                        matching(
+                                hasProperties(
+                                        GlobalStreamExchangeMode.ALL_EDGES_PIPELINED,
+                                        JobType.STREAMING,
+                                        false,
+                                        true)));
     }
 
     @Test
-    public void testExplicitOverridesDetectedMode() {
+    void testExplicitOverridesDetectedMode() {
         final SourceTransformation<Integer, ?, ?> bounded =
                 getSourceTransformation("Bounded Source", Boundedness.BOUNDED);
-        assertEquals(Boundedness.BOUNDED, bounded.getBoundedness());
+        assertThat(bounded.getBoundedness()).isEqualTo(Boundedness.BOUNDED);
 
         final StreamGraph graph = generateStreamGraph(RuntimeExecutionMode.AUTOMATIC, bounded);
-        assertThat(
-                graph,
-                hasProperties(
-                        GlobalStreamExchangeMode.ALL_EDGES_BLOCKING, JobType.BATCH, false, false));
+        assertThat(graph)
+                .is(
+                        matching(
+                                hasProperties(
+                                        GlobalStreamExchangeMode.ALL_EDGES_BLOCKING,
+                                        JobType.BATCH,
+                                        false,
+                                        false)));
 
         final StreamGraph streamingGraph =
                 generateStreamGraph(RuntimeExecutionMode.STREAMING, bounded);
-        assertThat(
-                streamingGraph,
-                hasProperties(
-                        GlobalStreamExchangeMode.ALL_EDGES_PIPELINED,
-                        JobType.STREAMING,
-                        false,
-                        true));
+        assertThat(streamingGraph)
+                .is(
+                        matching(
+                                hasProperties(
+                                        GlobalStreamExchangeMode.ALL_EDGES_PIPELINED,
+                                        JobType.STREAMING,
+                                        false,
+                                        true)));
     }
 
     private StreamGraph generateStreamGraph(
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamGraphGeneratorTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamGraphGeneratorTest.java
index c6f6979ef1f..7cf4a072a42 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamGraphGeneratorTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamGraphGeneratorTest.java
@@ -78,9 +78,7 @@ import org.apache.flink.streaming.util.TestExpandingSinkDeprecated;
 import org.apache.flink.util.AbstractID;
 import org.apache.flink.util.Collector;
 import org.apache.flink.util.OutputTag;
-import org.apache.flink.util.TestLogger;
 
-import org.assertj.core.api.Assertions;
 import org.hamcrest.Description;
 import org.hamcrest.FeatureMatcher;
 import org.hamcrest.Matcher;
@@ -98,11 +96,10 @@ import java.util.Map;
 import java.util.Set;
 import java.util.stream.Collectors;
 
+import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.hamcrest.MatcherAssert.assertThat;
+import static org.assertj.core.api.HamcrestCondition.matching;
 import static org.hamcrest.Matchers.equalTo;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.iterableWithSize;
 
 /**
  * Tests for {@link StreamGraphGenerator}. This only tests correct translation of split/select,
@@ -110,10 +107,10 @@ import static org.hamcrest.Matchers.iterableWithSize;
  * tests.
  */
 @SuppressWarnings("serial")
-public class StreamGraphGeneratorTest extends TestLogger {
+class StreamGraphGeneratorTest {
 
     @Test
-    public void generatorForwardsSavepointRestoreSettings() {
+    void generatorForwardsSavepointRestoreSettings() {
         StreamGraphGenerator streamGraphGenerator =
                 new StreamGraphGenerator(
                         Collections.emptyList(), new ExecutionConfig(), new CheckpointConfig());
@@ -121,11 +118,11 @@ public class StreamGraphGeneratorTest extends TestLogger {
         streamGraphGenerator.setSavepointRestoreSettings(SavepointRestoreSettings.forPath("hello"));
 
         StreamGraph streamGraph = streamGraphGenerator.generate();
-        assertThat(streamGraph.getSavepointRestoreSettings().getRestorePath(), is("hello"));
+        assertThat(streamGraph.getSavepointRestoreSettings().getRestorePath()).isEqualTo("hello");
     }
 
     @Test
-    public void testBufferTimeout() {
+    void testBufferTimeout() {
         final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         env.setBufferTimeout(77); // set timeout to some recognizable number
@@ -147,20 +144,19 @@ public class StreamGraphGeneratorTest extends TestLogger {
         for (StreamNode node : sg.getStreamNodes()) {
             switch (node.getOperatorName()) {
                 case "A":
-                    Assertions.assertThat(77L).isEqualTo(node.getBufferTimeout());
+                    assertThat(77L).isEqualTo(node.getBufferTimeout());
                     break;
                 case "B":
-                    Assertions.assertThat(node.getBufferTimeout()).isEqualTo(0L);
+                    assertThat(node.getBufferTimeout()).isEqualTo(0L);
                     break;
                 case "C":
-                    Assertions.assertThat(node.getBufferTimeout()).isEqualTo(12L);
+                    assertThat(node.getBufferTimeout()).isEqualTo(12L);
                     break;
                 case "D":
-                    Assertions.assertThat(node.getBufferTimeout()).isEqualTo(77L);
+                    assertThat(node.getBufferTimeout()).isEqualTo(77L);
                     break;
                 default:
-                    Assertions.assertThat(node.getOperatorFactory())
-                            .isInstanceOf(SourceOperatorFactory.class);
+                    assertThat(node.getOperatorFactory()).isInstanceOf(SourceOperatorFactory.class);
             }
         }
     }
@@ -172,7 +168,7 @@ public class StreamGraphGeneratorTest extends TestLogger {
      * StreamGraph when they are intermixed.
      */
     @Test
-    public void testVirtualTransformations() throws Exception {
+    void testVirtualTransformations() {
 
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
@@ -206,21 +202,13 @@ public class StreamGraphGeneratorTest extends TestLogger {
         StreamGraph graph = env.getStreamGraph();
 
         // rebalanceMap
-        Assertions.assertThat(
-                        graph.getStreamNode(rebalanceMap.getId())
-                                .getInEdges()
-                                .get(0)
-                                .getPartitioner())
+        assertThat(graph.getStreamNode(rebalanceMap.getId()).getInEdges().get(0).getPartitioner())
                 .isInstanceOf(RebalancePartitioner.class);
 
         // verify that only last partitioning takes precedence
-        Assertions.assertThat(
-                        graph.getStreamNode(broadcastMap.getId())
-                                .getInEdges()
-                                .get(0)
-                                .getPartitioner())
+        assertThat(graph.getStreamNode(broadcastMap.getId()).getInEdges().get(0).getPartitioner())
                 .isInstanceOf(BroadcastPartitioner.class);
-        Assertions.assertThat(
+        assertThat(
                         graph.getSourceVertex(
                                         graph.getStreamNode(broadcastMap.getId())
                                                 .getInEdges()
@@ -229,19 +217,19 @@ public class StreamGraphGeneratorTest extends TestLogger {
                 .isEqualTo(rebalanceMap.getId());
 
         // verify that partitioning in unions is preserved
-        Assertions.assertThat(
+        assertThat(
                         graph.getStreamNode(broadcastOperator.getId())
                                 .getOutEdges()
                                 .get(0)
                                 .getPartitioner())
                 .isInstanceOf(BroadcastPartitioner.class);
-        Assertions.assertThat(
+        assertThat(
                         graph.getStreamNode(globalOperator.getId())
                                 .getOutEdges()
                                 .get(0)
                                 .getPartitioner())
                 .isInstanceOf(GlobalPartitioner.class);
-        Assertions.assertThat(
+        assertThat(
                         graph.getStreamNode(shuffleOperator.getId())
                                 .getOutEdges()
                                 .get(0)
@@ -250,7 +238,7 @@ public class StreamGraphGeneratorTest extends TestLogger {
     }
 
     @Test
-    public void testOutputTypeConfigurationWithUdfStreamOperator() throws Exception {
+    void testOutputTypeConfigurationWithUdfStreamOperator() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         OutputTypeConfigurableFunction<Integer> function = new OutputTypeConfigurableFunction<>();
@@ -264,8 +252,8 @@ public class StreamGraphGeneratorTest extends TestLogger {
 
         env.getStreamGraph();
 
-        Assertions.assertThat(udfOperator).isInstanceOf(AbstractUdfStreamOperator.class);
-        Assertions.assertThat(function.getTypeInformation()).isEqualTo(BasicTypeInfo.INT_TYPE_INFO);
+        assertThat(udfOperator).isInstanceOf(AbstractUdfStreamOperator.class);
+        assertThat(function.getTypeInformation()).isEqualTo(BasicTypeInfo.INT_TYPE_INFO);
     }
 
     /**
@@ -273,7 +261,7 @@ public class StreamGraphGeneratorTest extends TestLogger {
      * output type. In this test case the output type must be BasicTypeInfo.INT_TYPE_INFO.
      */
     @Test
-    public void testOutputTypeConfigurationWithOneInputTransformation() throws Exception {
+    void testOutputTypeConfigurationWithOneInputTransformation() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         DataStream<Integer> source = env.fromData(1, 10);
@@ -291,12 +279,12 @@ public class StreamGraphGeneratorTest extends TestLogger {
 
         env.getStreamGraph();
 
-        Assertions.assertThat(outputTypeConfigurableOperation.getTypeInformation())
+        assertThat(outputTypeConfigurableOperation.getTypeInformation())
                 .isEqualTo(BasicTypeInfo.INT_TYPE_INFO);
     }
 
     @Test
-    public void testOutputTypeConfigurationWithTwoInputTransformation() throws Exception {
+    void testOutputTypeConfigurationWithTwoInputTransformation() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         DataStream<Integer> source1 = env.fromData(1, 10);
@@ -317,12 +305,12 @@ public class StreamGraphGeneratorTest extends TestLogger {
 
         env.getStreamGraph();
 
-        Assertions.assertThat(outputTypeConfigurableOperation.getTypeInformation())
+        assertThat(outputTypeConfigurableOperation.getTypeInformation())
                 .isEqualTo(BasicTypeInfo.INT_TYPE_INFO);
     }
 
     @Test
-    public void testMultipleInputTransformation() throws Exception {
+    void testMultipleInputTransformation() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         DataStream<Integer> source1 = env.fromData(1, 10);
@@ -343,22 +331,19 @@ public class StreamGraphGeneratorTest extends TestLogger {
                         .addInput(source3.getTransformation()));
 
         StreamGraph streamGraph = env.getStreamGraph();
-        Assertions.assertThat(streamGraph.getStreamNodes().size()).isEqualTo(4);
-
-        Assertions.assertThat(streamGraph.getStreamEdges(source1.getId(), transform.getId()).size())
-                .isEqualTo(1);
-        Assertions.assertThat(streamGraph.getStreamEdges(source2.getId(), transform.getId()).size())
-                .isEqualTo(1);
-        Assertions.assertThat(streamGraph.getStreamEdges(source3.getId(), transform.getId()).size())
-                .isEqualTo(1);
-        Assertions.assertThat(streamGraph.getStreamEdges(source1.getId()).size()).isEqualTo(1);
-        Assertions.assertThat(streamGraph.getStreamEdges(source2.getId()).size()).isEqualTo(1);
-        Assertions.assertThat(streamGraph.getStreamEdges(source3.getId()).size()).isEqualTo(1);
-        Assertions.assertThat(streamGraph.getStreamEdges(transform.getId()).size()).isEqualTo(0);
+        assertThat(streamGraph.getStreamNodes().size()).isEqualTo(4);
+
+        assertThat(streamGraph.getStreamEdges(source1.getId(), transform.getId())).hasSize(1);
+        assertThat(streamGraph.getStreamEdges(source2.getId(), transform.getId())).hasSize(1);
+        assertThat(streamGraph.getStreamEdges(source3.getId(), transform.getId())).hasSize(1);
+        assertThat(streamGraph.getStreamEdges(source1.getId())).hasSize(1);
+        assertThat(streamGraph.getStreamEdges(source2.getId())).hasSize(1);
+        assertThat(streamGraph.getStreamEdges(source3.getId())).hasSize(1);
+        assertThat(streamGraph.getStreamEdges(transform.getId())).hasSize(0);
     }
 
     @Test
-    public void testUnalignedCheckpointDisabledOnPointwise() {
+    void testUnalignedCheckpointDisabledOnPointwise() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
         env.setParallelism(42);
 
@@ -388,24 +373,29 @@ public class StreamGraphGeneratorTest extends TestLogger {
         DataStream<Long> map4 = map3.rescale().map(l -> l).setParallelism(1337);
 
         StreamGraph streamGraph = env.getStreamGraph();
-        Assertions.assertThat(streamGraph.getStreamNodes().size()).isEqualTo(7);
+        assertThat(streamGraph.getStreamNodes().size()).isEqualTo(7);
 
         // forward
-        assertThat(edge(streamGraph, source1, map1), supportsUnalignedCheckpoints(false));
+        assertThat(edge(streamGraph, source1, map1))
+                .is(matching(supportsUnalignedCheckpoints(false)));
         // shuffle
-        assertThat(edge(streamGraph, source2, map2), supportsUnalignedCheckpoints(true));
+        assertThat(edge(streamGraph, source2, map2))
+                .is(matching(supportsUnalignedCheckpoints(true)));
         // broadcast, but other channel is forwarded
-        assertThat(edge(streamGraph, map1, joined), supportsUnalignedCheckpoints(false));
+        assertThat(edge(streamGraph, map1, joined))
+                .is(matching(supportsUnalignedCheckpoints(false)));
         // forward
-        assertThat(edge(streamGraph, map2, joined), supportsUnalignedCheckpoints(false));
+        assertThat(edge(streamGraph, map2, joined))
+                .is(matching(supportsUnalignedCheckpoints(false)));
         // shuffle
-        assertThat(edge(streamGraph, joined, map3), supportsUnalignedCheckpoints(true));
+        assertThat(edge(streamGraph, joined, map3))
+                .is(matching(supportsUnalignedCheckpoints(true)));
         // rescale
-        assertThat(edge(streamGraph, map3, map4), supportsUnalignedCheckpoints(false));
+        assertThat(edge(streamGraph, map3, map4)).is(matching(supportsUnalignedCheckpoints(false)));
     }
 
     @Test
-    public void testUnalignedCheckpointDisabledOnBroadcast() {
+    void testUnalignedCheckpointDisabledOnBroadcast() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
         env.setParallelism(42);
 
@@ -432,20 +422,23 @@ public class StreamGraphGeneratorTest extends TestLogger {
                                 });
 
         StreamGraph streamGraph = env.getStreamGraph();
-        Assertions.assertThat(streamGraph.getStreamNodes().size()).isEqualTo(4);
+        assertThat(streamGraph.getStreamNodes().size()).isEqualTo(4);
 
         // single broadcast
-        assertThat(edge(streamGraph, source1, map1), supportsUnalignedCheckpoints(false));
+        assertThat(edge(streamGraph, source1, map1))
+                .is(matching(supportsUnalignedCheckpoints(false)));
         // keyed, connected with broadcast
-        assertThat(edge(streamGraph, source2, joined), supportsUnalignedCheckpoints(false));
+        assertThat(edge(streamGraph, source2, joined))
+                .is(matching(supportsUnalignedCheckpoints(false)));
         // broadcast, connected with keyed
-        assertThat(edge(streamGraph, map1, joined), supportsUnalignedCheckpoints(false));
+        assertThat(edge(streamGraph, map1, joined))
+                .is(matching(supportsUnalignedCheckpoints(false)));
     }
 
     private static StreamEdge edge(
             StreamGraph streamGraph, DataStream<Long> op1, DataStream<Long> op2) {
         List<StreamEdge> streamEdges = streamGraph.getStreamEdges(op1.getId(), op2.getId());
-        assertThat(streamEdges, iterableWithSize(1));
+        assertThat(streamEdges).hasSize(1);
         return streamEdges.get(0);
     }
 
@@ -466,7 +459,7 @@ public class StreamGraphGeneratorTest extends TestLogger {
      * maximum parallelism.
      */
     @Test
-    public void testSetupOfKeyGroupPartitioner() {
+    void testSetupOfKeyGroupPartitioner() {
         int maxParallelism = 42;
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
         env.getConfig().setMaxParallelism(maxParallelism);
@@ -487,7 +480,7 @@ public class StreamGraphGeneratorTest extends TestLogger {
 
     /** Tests that the global and operator-wide max parallelism setting is respected. */
     @Test
-    public void testMaxParallelismForwarding() {
+    void testMaxParallelismForwarding() {
         int globalMaxParallelism = 42;
         int keyedResult2MaxParallelism = 17;
 
@@ -511,9 +504,8 @@ public class StreamGraphGeneratorTest extends TestLogger {
         StreamNode keyedResult1Node = graph.getStreamNode(keyedResult1.getId());
         StreamNode keyedResult2Node = graph.getStreamNode(keyedResult2.getId());
 
-        Assertions.assertThat(keyedResult1Node.getMaxParallelism()).isEqualTo(globalMaxParallelism);
-        Assertions.assertThat(keyedResult2Node.getMaxParallelism())
-                .isEqualTo(keyedResult2MaxParallelism);
+        assertThat(keyedResult1Node.getMaxParallelism()).isEqualTo(globalMaxParallelism);
+        assertThat(keyedResult2Node.getMaxParallelism()).isEqualTo(keyedResult2MaxParallelism);
     }
 
     /**
@@ -521,7 +513,7 @@ public class StreamGraphGeneratorTest extends TestLogger {
      * specified.
      */
     @Test
-    public void testAutoMaxParallelism() {
+    void testAutoMaxParallelism() {
         int globalParallelism = 42;
         int mapParallelism = 17;
         int maxParallelism = 21;
@@ -558,13 +550,13 @@ public class StreamGraphGeneratorTest extends TestLogger {
         StreamNode keyedResult3Node = graph.getStreamNode(keyedResult3.getId());
         StreamNode keyedResult4Node = graph.getStreamNode(keyedResult4.getId());
 
-        Assertions.assertThat(keyedResult3Node.getMaxParallelism()).isEqualTo(maxParallelism);
-        Assertions.assertThat(keyedResult4Node.getMaxParallelism()).isEqualTo(maxParallelism);
+        assertThat(keyedResult3Node.getMaxParallelism()).isEqualTo(maxParallelism);
+        assertThat(keyedResult4Node.getMaxParallelism()).isEqualTo(maxParallelism);
     }
 
     /** Tests that the max parallelism is properly set for connected streams. */
     @Test
-    public void testMaxParallelismWithConnectedKeyedStream() {
+    void testMaxParallelismWithConnectedKeyedStream() {
         int maxParallelism = 42;
 
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
@@ -596,7 +588,7 @@ public class StreamGraphGeneratorTest extends TestLogger {
      * sort by its id.
      */
     @Test
-    public void testSinkIdComparison() {
+    void testSinkIdComparison() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
         DataStream<Integer> source = env.fromData(1, 2, 3);
         for (int i = 0; i < 32; i++) {
@@ -616,7 +608,7 @@ public class StreamGraphGeneratorTest extends TestLogger {
 
     /** Test iteration job, check slot sharing group and co-location group. */
     @Test
-    public void testIteration() {
+    void testIteration() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         DataStream<Integer> source = env.fromData(1, 2, 3).name("source");
@@ -632,19 +624,19 @@ public class StreamGraphGeneratorTest extends TestLogger {
         StreamGraph streamGraph = env.getStreamGraph();
         for (Tuple2<StreamNode, StreamNode> iterationPair :
                 streamGraph.getIterationSourceSinkPairs()) {
-            Assertions.assertThat(iterationPair.f0.getCoLocationGroup()).isNotNull();
-            Assertions.assertThat(iterationPair.f1.getCoLocationGroup())
+            assertThat(iterationPair.f0.getCoLocationGroup()).isNotNull();
+            assertThat(iterationPair.f1.getCoLocationGroup())
                     .isEqualTo(iterationPair.f0.getCoLocationGroup());
 
-            Assertions.assertThat(iterationPair.f0.getSlotSharingGroup())
+            assertThat(iterationPair.f0.getSlotSharingGroup())
                     .isEqualTo(StreamGraphGenerator.DEFAULT_SLOT_SHARING_GROUP);
-            Assertions.assertThat(iterationPair.f1.getSlotSharingGroup())
+            assertThat(iterationPair.f1.getSlotSharingGroup())
                     .isEqualTo(iterationPair.f0.getSlotSharingGroup());
 
             final ResourceSpec sourceMinResources = iterationPair.f0.getMinResources();
             final ResourceSpec sinkMinResources = iterationPair.f1.getMinResources();
             final ResourceSpec iterationResources = sourceMinResources.merge(sinkMinResources);
-            assertThat(iterationResources, equalsResourceSpec(resources));
+            assertThat(iterationResources).is(matching(equalsResourceSpec(resources)));
         }
     }
 
@@ -654,7 +646,7 @@ public class StreamGraphGeneratorTest extends TestLogger {
 
     /** Test slot sharing is enabled. */
     @Test
-    public void testEnableSlotSharing() {
+    void testEnableSlotSharing() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
         DataStream<Integer> sourceDataStream = env.fromData(1, 2, 3);
         DataStream<Integer> mapDataStream = sourceDataStream.map(x -> x + 1);
@@ -671,13 +663,13 @@ public class StreamGraphGeneratorTest extends TestLogger {
 
         Collection<StreamNode> streamNodes = streamGraph.getStreamNodes();
         for (StreamNode streamNode : streamNodes) {
-            Assertions.assertThat(streamNode.getSlotSharingGroup())
+            assertThat(streamNode.getSlotSharingGroup())
                     .isEqualTo(StreamGraphGenerator.DEFAULT_SLOT_SHARING_GROUP);
         }
     }
 
     @Test
-    public void testSetManagedMemoryWeight() {
+    void testSetManagedMemoryWeight() {
         final int weight = 123;
         final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
         final DataStream<Integer> source = env.fromData(1, 2, 3).name("source");
@@ -689,18 +681,18 @@ public class StreamGraphGeneratorTest extends TestLogger {
         for (StreamNode streamNode : streamGraph.getStreamNodes()) {
             if (streamNode.getOperatorName().contains("source")) {
                 assertThat(
-                        streamNode
-                                .getManagedMemoryOperatorScopeUseCaseWeights()
-                                .get(ManagedMemoryUseCase.OPERATOR),
-                        is(weight));
+                                streamNode
+                                        .getManagedMemoryOperatorScopeUseCaseWeights()
+                                        .get(ManagedMemoryUseCase.OPERATOR))
+                        .isEqualTo(weight);
             } else {
-                assertThat(streamNode.getManagedMemoryOperatorScopeUseCaseWeights().size(), is(0));
+                assertThat(streamNode.getManagedMemoryOperatorScopeUseCaseWeights()).isEmpty();
             }
         }
     }
 
     @Test
-    public void testSetSlotSharingResource() {
+    void testSetSlotSharingResource() {
         final String slotSharingGroup1 = "a";
         final String slotSharingGroup2 = "b";
         final ResourceProfile resourceProfile1 = ResourceProfile.fromResources(1, 10);
@@ -730,22 +722,18 @@ public class StreamGraphGeneratorTest extends TestLogger {
                         .setSlotSharingGroupResource(slotSharingGroupResource)
                         .generate();
 
+        assertThat(streamGraph.getSlotSharingGroupResource(slotSharingGroup1))
+                .hasValue(resourceProfile1);
+        assertThat(streamGraph.getSlotSharingGroupResource(slotSharingGroup2))
+                .hasValue(resourceProfile2);
         assertThat(
-                streamGraph.getSlotSharingGroupResource(slotSharingGroup1).get(),
-                equalTo(resourceProfile1));
-        assertThat(
-                streamGraph.getSlotSharingGroupResource(slotSharingGroup2).get(),
-                equalTo(resourceProfile2));
-        assertThat(
-                streamGraph
-                        .getSlotSharingGroupResource(
-                                StreamGraphGenerator.DEFAULT_SLOT_SHARING_GROUP)
-                        .get(),
-                equalTo(resourceProfile3));
+                        streamGraph.getSlotSharingGroupResource(
+                                StreamGraphGenerator.DEFAULT_SLOT_SHARING_GROUP))
+                .hasValue(resourceProfile3);
     }
 
     @Test
-    public void testSettingSavepointRestoreSettings() {
+    void testSettingSavepointRestoreSettings() {
         Configuration config = new Configuration();
         config.set(StateRecoveryOptions.SAVEPOINT_PATH, "/tmp/savepoint");
 
@@ -759,13 +747,12 @@ public class StreamGraphGeneratorTest extends TestLogger {
 
         SavepointRestoreSettings savepointRestoreSettings =
                 streamGraph.getSavepointRestoreSettings();
-        assertThat(
-                savepointRestoreSettings,
-                equalTo(SavepointRestoreSettings.forPath("/tmp/savepoint")));
+        assertThat(savepointRestoreSettings)
+                .isEqualTo(SavepointRestoreSettings.forPath("/tmp/savepoint"));
     }
 
     @Test
-    public void testSettingSavepointRestoreSettingsSetterOverrides() {
+    void testSettingSavepointRestoreSettingsSetterOverrides() {
         Configuration config = new Configuration();
         config.set(StateRecoveryOptions.SAVEPOINT_PATH, "/tmp/savepoint");
 
@@ -780,13 +767,12 @@ public class StreamGraphGeneratorTest extends TestLogger {
 
         SavepointRestoreSettings savepointRestoreSettings =
                 streamGraph.getSavepointRestoreSettings();
-        assertThat(
-                savepointRestoreSettings,
-                equalTo(SavepointRestoreSettings.forPath("/tmp/savepoint1")));
+        assertThat(savepointRestoreSettings)
+                .isEqualTo(SavepointRestoreSettings.forPath("/tmp/savepoint1"));
     }
 
     @Test
-    public void testConfigureSlotSharingGroupResource() {
+    void testConfigureSlotSharingGroupResource() {
         final SlotSharingGroup ssg1 =
                 SlotSharingGroup.newBuilder("ssg1").setCpuCores(1).setTaskHeapMemoryMB(100).build();
         final SlotSharingGroup ssg2 =
@@ -810,22 +796,18 @@ public class StreamGraphGeneratorTest extends TestLogger {
                 .slotSharingGroup(ssg1);
 
         final StreamGraph streamGraph = env.getStreamGraph();
+        assertThat(streamGraph.getSlotSharingGroupResource("ssg1"))
+                .hasValue(ResourceProfile.fromResources(1, 100));
+        assertThat(streamGraph.getSlotSharingGroupResource("ssg2"))
+                .hasValue(ResourceProfile.fromResources(2, 200));
         assertThat(
-                streamGraph.getSlotSharingGroupResource("ssg1").get(),
-                is(ResourceProfile.fromResources(1, 100)));
-        assertThat(
-                streamGraph.getSlotSharingGroupResource("ssg2").get(),
-                is(ResourceProfile.fromResources(2, 200)));
-        assertThat(
-                streamGraph
-                        .getSlotSharingGroupResource(
-                                StreamGraphGenerator.DEFAULT_SLOT_SHARING_GROUP)
-                        .get(),
-                is(ResourceProfile.fromResources(3, 300)));
+                        streamGraph.getSlotSharingGroupResource(
+                                StreamGraphGenerator.DEFAULT_SLOT_SHARING_GROUP))
+                .hasValue(ResourceProfile.fromResources(3, 300));
     }
 
     @Test
-    public void testConflictSlotSharingGroup() {
+    void testConflictSlotSharingGroup() {
         final SlotSharingGroup ssg =
                 SlotSharingGroup.newBuilder("ssg").setCpuCores(1).setTaskHeapMemoryMB(100).build();
         final SlotSharingGroup ssgConflict =
@@ -838,12 +820,11 @@ public class StreamGraphGeneratorTest extends TestLogger {
                 .sinkTo(new DiscardingSink<>())
                 .slotSharingGroup(ssgConflict);
 
-        Assertions.assertThatThrownBy(env::getStreamGraph)
-                .isInstanceOf(IllegalArgumentException.class);
+        assertThatThrownBy(env::getStreamGraph).isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void testTrackTransformationsByIdentity() {
+    void testTrackTransformationsByIdentity() {
         final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
         final Transformation<?> noopTransformation = env.fromSequence(1, 2).getTransformation();
 
@@ -860,7 +841,7 @@ public class StreamGraphGeneratorTest extends TestLogger {
     }
 
     @Test
-    public void testResetBatchExchangeModeInStreamingExecution() {
+    void testResetBatchExchangeModeInStreamingExecution() {
         final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         DataStream<Integer> sourceDataStream = env.fromData(1, 2, 3);
@@ -879,11 +860,11 @@ public class StreamGraphGeneratorTest extends TestLogger {
                         .map(StreamNode::getId)
                         .sorted(Integer::compare)
                         .collect(Collectors.toList());
-        Assertions.assertThat(streamGraph.getStreamEdges(nodeIds.get(0), nodeIds.get(1)))
+        assertThat(streamGraph.getStreamEdges(nodeIds.get(0), nodeIds.get(1)))
                 .hasSize(1)
                 .satisfies(
                         e ->
-                                Assertions.assertThat(e.get(0).getExchangeMode())
+                                assertThat(e.get(0).getExchangeMode())
                                         .isEqualTo(StreamExchangeMode.UNDEFINED));
     }
 
@@ -892,7 +873,7 @@ public class StreamGraphGeneratorTest extends TestLogger {
      */
     @Deprecated
     @Test
-    public void testAutoParallelismForExpandedTransformationsDeprecated() {
+    void testAutoParallelismForExpandedTransformationsDeprecated() {
         final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         env.setParallelism(2);
@@ -908,13 +889,13 @@ public class StreamGraphGeneratorTest extends TestLogger {
                 .forEach(
                         node -> {
                             if (!node.getOperatorName().startsWith("Source")) {
-                                Assertions.assertThat(node.getParallelism()).isEqualTo(2);
+                                assertThat(node.getParallelism()).isEqualTo(2);
                             }
                         });
     }
 
     @Test
-    public void testAutoParallelismForExpandedTransformations() {
+    void testAutoParallelismForExpandedTransformations() {
         final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         env.setParallelism(2);
@@ -930,13 +911,13 @@ public class StreamGraphGeneratorTest extends TestLogger {
                 .forEach(
                         node -> {
                             if (!node.getOperatorName().startsWith("Source")) {
-                                Assertions.assertThat(node.getParallelism()).isEqualTo(2);
+                                assertThat(node.getParallelism()).isEqualTo(2);
                             }
                         });
     }
 
     @Test
-    public void testCacheTransformation() {
+    void testCacheTransformation() {
         final TestingStreamExecutionEnvironment env = new TestingStreamExecutionEnvironment();
         env.setRuntimeMode(RuntimeExecutionMode.BATCH);
 
@@ -947,8 +928,7 @@ public class StreamGraphGeneratorTest extends TestLogger {
                         .reduce(Integer::sum)
                         .setParallelism(upstreamParallelism)
                         .cache();
-        Assertions.assertThat(cachedStream.getTransformation())
-                .isInstanceOf(CacheTransformation.class);
+        assertThat(cachedStream.getTransformation()).isInstanceOf(CacheTransformation.class);
         CacheTransformation<Integer> cacheTransformation =
                 (CacheTransformation<Integer>) cachedStream.getTransformation();
 
@@ -964,7 +944,7 @@ public class StreamGraphGeneratorTest extends TestLogger {
     }
 
     @Test
-    public void testCacheSideOutput() {
+    void testCacheSideOutput() {
         final TestingStreamExecutionEnvironment env = new TestingStreamExecutionEnvironment();
         env.setRuntimeMode(RuntimeExecutionMode.BATCH);
 
@@ -973,8 +953,7 @@ public class StreamGraphGeneratorTest extends TestLogger {
                 env.fromData(1, 2, 3).map(i -> i).setParallelism(upstreamParallelism);
         final DataStream<Integer> sideOutputCache =
                 stream.getSideOutput(new OutputTag<Integer>("1") {}).cache();
-        Assertions.assertThat(sideOutputCache.getTransformation())
-                .isInstanceOf(CacheTransformation.class);
+        assertThat(sideOutputCache.getTransformation()).isInstanceOf(CacheTransformation.class);
         final CacheTransformation<Integer> cacheTransformation =
                 (CacheTransformation<Integer>) sideOutputCache.getTransformation();
         sideOutputCache.print();
@@ -993,7 +972,7 @@ public class StreamGraphGeneratorTest extends TestLogger {
             CacheTransformation<Integer> cacheTransformation,
             StreamGraph streamGraph,
             String expectedTagId) {
-        Assertions.assertThat(streamGraph.getStreamNodes())
+        assertThat(streamGraph.getStreamNodes())
                 .anyMatch(
                         node -> {
                             if (!CacheTransformationTranslator.CACHE_PRODUCER_OPERATOR_NAME.equals(
@@ -1001,22 +980,17 @@ public class StreamGraphGeneratorTest extends TestLogger {
                                 return false;
                             }
 
-                            Assertions.assertThat(node.getParallelism())
-                                    .isEqualTo(upstreamParallelism);
-                            Assertions.assertThat(node.getInEdges().size()).isEqualTo(1);
+                            assertThat(node.getParallelism()).isEqualTo(upstreamParallelism);
+                            assertThat(node.getInEdges().size()).isEqualTo(1);
                             final StreamEdge inEdge = node.getInEdges().get(0);
-                            Assertions.assertThat(inEdge.getPartitioner())
+                            assertThat(inEdge.getPartitioner())
                                     .isInstanceOf(ForwardPartitioner.class);
                             if (expectedTagId != null) {
-                                Assertions.assertThat(inEdge.getOutputTag().getId())
-                                        .isEqualTo(expectedTagId);
+                                assertThat(inEdge.getOutputTag().getId()).isEqualTo(expectedTagId);
                             }
 
-                            Assertions.assertThat(inEdge.getIntermediateDatasetIdToProduce())
-                                    .isNotNull();
-                            Assertions.assertThat(
-                                            new AbstractID(
-                                                    inEdge.getIntermediateDatasetIdToProduce()))
+                            assertThat(inEdge.getIntermediateDatasetIdToProduce()).isNotNull();
+                            assertThat(new AbstractID(inEdge.getIntermediateDatasetIdToProduce()))
                                     .isEqualTo(cacheTransformation.getDatasetId());
                             return true;
                         });
@@ -1026,7 +1000,7 @@ public class StreamGraphGeneratorTest extends TestLogger {
             StreamExecutionEnvironment env,
             int upstreamParallelism,
             CacheTransformation<Integer> cacheTransformation) {
-        Assertions.assertThat(env.getStreamGraph().getStreamNodes())
+        assertThat(env.getStreamGraph().getStreamNodes())
                 .anyMatch(
                         node -> {
                             if (!CacheTransformationTranslator.CACHE_CONSUMER_OPERATOR_NAME.equals(
@@ -1034,9 +1008,8 @@ public class StreamGraphGeneratorTest extends TestLogger {
                                 return false;
                             }
 
-                            Assertions.assertThat(node.getParallelism())
-                                    .isEqualTo(upstreamParallelism);
-                            Assertions.assertThat(new AbstractID(node.getConsumeClusterDatasetId()))
+                            assertThat(node.getParallelism()).isEqualTo(upstreamParallelism);
+                            assertThat(new AbstractID(node.getConsumeClusterDatasetId()))
                                     .isEqualTo(cacheTransformation.getDatasetId());
                             return true;
                         });
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamingJobGraphGeneratorTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamingJobGraphGeneratorTest.java
index 4aa9ffa31f2..86e77a4254a 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamingJobGraphGeneratorTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamingJobGraphGeneratorTest.java
@@ -130,14 +130,12 @@ import org.apache.flink.streaming.util.TestAnyModeReadingStreamOperator;
 import org.apache.flink.util.AbstractID;
 import org.apache.flink.util.Collector;
 import org.apache.flink.util.SerializedValue;
-import org.apache.flink.util.TestLoggerExtension;
 
 import org.apache.flink.shaded.guava31.com.google.common.collect.Iterables;
 
 import org.assertj.core.api.Assertions;
 import org.assertj.core.data.Offset;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.ValueSource;
 
@@ -166,7 +164,6 @@ import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 /** Tests for {@link StreamingJobGraphGenerator}. */
-@ExtendWith(TestLoggerExtension.class)
 @SuppressWarnings("serial")
 class StreamingJobGraphGeneratorTest {
 
@@ -2123,7 +2120,7 @@ class StreamingJobGraphGeneratorTest {
     }
 
     @Test
-    public void testCoordinatedSerializationException() {
+    void testCoordinatedSerializationException() {
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
         DataStreamSource<Integer> source = env.fromData(1, 2, 3);
         env.addOperator(
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamingJobGraphGeneratorWithGlobalStreamExchangeModeTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamingJobGraphGeneratorWithGlobalStreamExchangeModeTest.java
index d9b476ccf96..8fbc434af2a 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamingJobGraphGeneratorWithGlobalStreamExchangeModeTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamingJobGraphGeneratorWithGlobalStreamExchangeModeTest.java
@@ -26,32 +26,28 @@ import org.apache.flink.streaming.api.transformations.PartitionTransformation;
 import org.apache.flink.streaming.api.transformations.StreamExchangeMode;
 import org.apache.flink.streaming.runtime.partitioner.ForwardPartitioner;
 import org.apache.flink.streaming.runtime.partitioner.RescalePartitioner;
-import org.apache.flink.util.TestLogger;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import java.util.List;
 
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /**
  * Tests for {@link StreamingJobGraphGenerator} on different {@link GlobalStreamExchangeMode}
  * settings.
  */
-public class StreamingJobGraphGeneratorWithGlobalStreamExchangeModeTest extends TestLogger {
+class StreamingJobGraphGeneratorWithGlobalStreamExchangeModeTest {
 
     @Test
-    public void testDefaultGlobalExchangeModeIsAllEdgesPipelined() {
+    void testDefaultGlobalExchangeModeIsAllEdgesPipelined() {
         final StreamGraph streamGraph = createStreamGraph();
-        assertThat(
-                streamGraph.getGlobalStreamExchangeMode(),
-                is(GlobalStreamExchangeMode.ALL_EDGES_PIPELINED));
+        assertThat(streamGraph.getGlobalStreamExchangeMode())
+                .isEqualTo(GlobalStreamExchangeMode.ALL_EDGES_PIPELINED);
     }
 
     @Test
-    public void testAllEdgesBlockingMode() {
+    void testAllEdgesBlockingMode() {
         final StreamGraph streamGraph =
                 createStreamGraph(GlobalStreamExchangeMode.ALL_EDGES_BLOCKING);
         final JobGraph jobGraph = StreamingJobGraphGenerator.createJobGraph(streamGraph);
@@ -61,19 +57,16 @@ public class StreamingJobGraphGeneratorWithGlobalStreamExchangeModeTest extends
         final JobVertex map1Vertex = verticesSorted.get(1);
         final JobVertex map2Vertex = verticesSorted.get(2);
 
-        assertEquals(
-                ResultPartitionType.BLOCKING,
-                sourceVertex.getProducedDataSets().get(0).getResultType());
-        assertEquals(
-                ResultPartitionType.BLOCKING,
-                map1Vertex.getProducedDataSets().get(0).getResultType());
-        assertEquals(
-                ResultPartitionType.BLOCKING,
-                map2Vertex.getProducedDataSets().get(0).getResultType());
+        assertThat(sourceVertex.getProducedDataSets().get(0).getResultType())
+                .isEqualTo(ResultPartitionType.BLOCKING);
+        assertThat(map1Vertex.getProducedDataSets().get(0).getResultType())
+                .isEqualTo(ResultPartitionType.BLOCKING);
+        assertThat(map2Vertex.getProducedDataSets().get(0).getResultType())
+                .isEqualTo(ResultPartitionType.BLOCKING);
     }
 
     @Test
-    public void testAllEdgesPipelinedMode() {
+    void testAllEdgesPipelinedMode() {
         final StreamGraph streamGraph = createStreamGraph();
         streamGraph.setGlobalStreamExchangeMode(GlobalStreamExchangeMode.ALL_EDGES_PIPELINED);
         final JobGraph jobGraph = StreamingJobGraphGenerator.createJobGraph(streamGraph);
@@ -83,19 +76,16 @@ public class StreamingJobGraphGeneratorWithGlobalStreamExchangeModeTest extends
         final JobVertex map1Vertex = verticesSorted.get(1);
         final JobVertex map2Vertex = verticesSorted.get(2);
 
-        assertEquals(
-                ResultPartitionType.PIPELINED_BOUNDED,
-                sourceVertex.getProducedDataSets().get(0).getResultType());
-        assertEquals(
-                ResultPartitionType.PIPELINED_BOUNDED,
-                map1Vertex.getProducedDataSets().get(0).getResultType());
-        assertEquals(
-                ResultPartitionType.PIPELINED_BOUNDED,
-                map2Vertex.getProducedDataSets().get(0).getResultType());
+        assertThat(sourceVertex.getProducedDataSets().get(0).getResultType())
+                .isEqualTo(ResultPartitionType.PIPELINED_BOUNDED);
+        assertThat(map1Vertex.getProducedDataSets().get(0).getResultType())
+                .isEqualTo(ResultPartitionType.PIPELINED_BOUNDED);
+        assertThat(map2Vertex.getProducedDataSets().get(0).getResultType())
+                .isEqualTo(ResultPartitionType.PIPELINED_BOUNDED);
     }
 
     @Test
-    public void testForwardEdgesPipelinedMode() {
+    void testForwardEdgesPipelinedMode() {
         final StreamGraph streamGraph =
                 createStreamGraph(GlobalStreamExchangeMode.FORWARD_EDGES_PIPELINED);
         final JobGraph jobGraph = StreamingJobGraphGenerator.createJobGraph(streamGraph);
@@ -105,19 +95,16 @@ public class StreamingJobGraphGeneratorWithGlobalStreamExchangeModeTest extends
         final JobVertex map1Vertex = verticesSorted.get(1);
         final JobVertex map2Vertex = verticesSorted.get(2);
 
-        assertEquals(
-                ResultPartitionType.PIPELINED_BOUNDED,
-                sourceVertex.getProducedDataSets().get(0).getResultType());
-        assertEquals(
-                ResultPartitionType.BLOCKING,
-                map1Vertex.getProducedDataSets().get(0).getResultType());
-        assertEquals(
-                ResultPartitionType.BLOCKING,
-                map2Vertex.getProducedDataSets().get(0).getResultType());
+        assertThat(sourceVertex.getProducedDataSets().get(0).getResultType())
+                .isEqualTo(ResultPartitionType.PIPELINED_BOUNDED);
+        assertThat(map1Vertex.getProducedDataSets().get(0).getResultType())
+                .isEqualTo(ResultPartitionType.BLOCKING);
+        assertThat(map2Vertex.getProducedDataSets().get(0).getResultType())
+                .isEqualTo(ResultPartitionType.BLOCKING);
     }
 
     @Test
-    public void testPointwiseEdgesPipelinedMode() {
+    void testPointwiseEdgesPipelinedMode() {
         final StreamGraph streamGraph =
                 createStreamGraph(GlobalStreamExchangeMode.POINTWISE_EDGES_PIPELINED);
         final JobGraph jobGraph = StreamingJobGraphGenerator.createJobGraph(streamGraph);
@@ -127,19 +114,16 @@ public class StreamingJobGraphGeneratorWithGlobalStreamExchangeModeTest extends
         final JobVertex map1Vertex = verticesSorted.get(1);
         final JobVertex map2Vertex = verticesSorted.get(2);
 
-        assertEquals(
-                ResultPartitionType.PIPELINED_BOUNDED,
-                sourceVertex.getProducedDataSets().get(0).getResultType());
-        assertEquals(
-                ResultPartitionType.PIPELINED_BOUNDED,
-                map1Vertex.getProducedDataSets().get(0).getResultType());
-        assertEquals(
-                ResultPartitionType.BLOCKING,
-                map2Vertex.getProducedDataSets().get(0).getResultType());
+        assertThat(sourceVertex.getProducedDataSets().get(0).getResultType())
+                .isEqualTo(ResultPartitionType.PIPELINED_BOUNDED);
+        assertThat(map1Vertex.getProducedDataSets().get(0).getResultType())
+                .isEqualTo(ResultPartitionType.PIPELINED_BOUNDED);
+        assertThat(map2Vertex.getProducedDataSets().get(0).getResultType())
+                .isEqualTo(ResultPartitionType.BLOCKING);
     }
 
     @Test
-    public void testGlobalExchangeModeDoesNotOverrideSpecifiedExchangeMode() {
+    void testGlobalExchangeModeDoesNotOverrideSpecifiedExchangeMode() {
         final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
         final DataStream<Integer> source = env.fromData(1, 2, 3).setParallelism(1);
         final DataStream<Integer> forward =
@@ -158,9 +142,8 @@ public class StreamingJobGraphGeneratorWithGlobalStreamExchangeModeTest extends
         final List<JobVertex> verticesSorted = jobGraph.getVerticesSortedTopologicallyFromSources();
         final JobVertex sourceVertex = verticesSorted.get(0);
 
-        assertEquals(
-                ResultPartitionType.PIPELINED_BOUNDED,
-                sourceVertex.getProducedDataSets().get(0).getResultType());
+        assertThat(sourceVertex.getProducedDataSets().get(0).getResultType())
+                .isEqualTo(ResultPartitionType.PIPELINED_BOUNDED);
     }
 
     /**
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/AbstractStreamOperatorTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/AbstractStreamOperatorTest.java
index afc52d609af..54eebf1d4ec 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/AbstractStreamOperatorTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/AbstractStreamOperatorTest.java
@@ -48,7 +48,7 @@ import org.apache.flink.util.Preconditions;
 import org.hamcrest.Description;
 import org.hamcrest.Matcher;
 import org.hamcrest.TypeSafeMatcher;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
@@ -60,10 +60,8 @@ import java.util.Map;
 import java.util.Random;
 import java.util.concurrent.ConcurrentLinkedQueue;
 
-import static junit.framework.TestCase.assertTrue;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.contains;
-import static org.hamcrest.Matchers.empty;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.HamcrestCondition.matching;
 
 /**
  * Tests for the facilities provided by {@link AbstractStreamOperator}. This mostly tests timers and
@@ -101,7 +99,7 @@ public class AbstractStreamOperatorTest {
     }
 
     @Test
-    public void testStateDoesNotInterfere() throws Exception {
+    void testStateDoesNotInterfere() throws Exception {
         try (KeyedOneInputStreamOperatorTestHarness<Integer, Tuple2<Integer, String>, String>
                 testHarness = createTestHarness()) {
             testHarness.open();
@@ -112,9 +110,8 @@ public class AbstractStreamOperatorTest {
             testHarness.processElement(new Tuple2<>(1, "EMIT_STATE"), 0);
             testHarness.processElement(new Tuple2<>(0, "EMIT_STATE"), 0);
 
-            assertThat(
-                    extractResult(testHarness),
-                    contains("ON_ELEMENT:1:CIAO", "ON_ELEMENT:0:HELLO"));
+            assertThat(extractResult(testHarness))
+                    .contains("ON_ELEMENT:1:CIAO", "ON_ELEMENT:0:HELLO");
         }
     }
 
@@ -123,7 +120,7 @@ public class AbstractStreamOperatorTest {
      * was set.
      */
     @Test
-    public void testEventTimeTimersDontInterfere() throws Exception {
+    void testEventTimeTimersDontInterfere() throws Exception {
         try (KeyedOneInputStreamOperatorTestHarness<Integer, Tuple2<Integer, String>, String>
                 testHarness = createTestHarness()) {
             testHarness.open();
@@ -139,11 +136,11 @@ public class AbstractStreamOperatorTest {
 
             testHarness.processWatermark(10L);
 
-            assertThat(extractResult(testHarness), contains("ON_EVENT_TIME:HELLO"));
+            assertThat(extractResult(testHarness)).contains("ON_EVENT_TIME:HELLO");
 
             testHarness.processWatermark(20L);
 
-            assertThat(extractResult(testHarness), contains("ON_EVENT_TIME:CIAO"));
+            assertThat(extractResult(testHarness)).contains("ON_EVENT_TIME:CIAO");
         }
     }
 
@@ -152,7 +149,7 @@ public class AbstractStreamOperatorTest {
      * timer was set.
      */
     @Test
-    public void testProcessingTimeTimersDontInterfere() throws Exception {
+    void testProcessingTimeTimersDontInterfere() throws Exception {
         try (KeyedOneInputStreamOperatorTestHarness<Integer, Tuple2<Integer, String>, String>
                 testHarness = createTestHarness()) {
             testHarness.open();
@@ -168,17 +165,17 @@ public class AbstractStreamOperatorTest {
 
             testHarness.setProcessingTime(10L);
 
-            assertThat(extractResult(testHarness), contains("ON_PROC_TIME:HELLO"));
+            assertThat(extractResult(testHarness)).contains("ON_PROC_TIME:HELLO");
 
             testHarness.setProcessingTime(20L);
 
-            assertThat(extractResult(testHarness), contains("ON_PROC_TIME:CIAO"));
+            assertThat(extractResult(testHarness)).contains("ON_PROC_TIME:CIAO");
         }
     }
 
     /** Verify that a low-level timer is set for processing-time timers in case of restore. */
     @Test
-    public void testEnsureProcessingTimeTimerRegisteredOnRestore() throws Exception {
+    void testEnsureProcessingTimeTimerRegisteredOnRestore() throws Exception {
         OperatorSubtaskState snapshot;
         try (KeyedOneInputStreamOperatorTestHarness<Integer, Tuple2<Integer, String>, String>
                 testHarness = createTestHarness()) {
@@ -206,17 +203,17 @@ public class AbstractStreamOperatorTest {
 
             testHarness1.setProcessingTime(10L);
 
-            assertThat(extractResult(testHarness1), contains("ON_PROC_TIME:HELLO"));
+            assertThat(extractResult(testHarness1)).contains("ON_PROC_TIME:HELLO");
 
             testHarness1.setProcessingTime(20L);
 
-            assertThat(extractResult(testHarness1), contains("ON_PROC_TIME:CIAO"));
+            assertThat(extractResult(testHarness1)).contains("ON_PROC_TIME:CIAO");
         }
     }
 
     /** Verify that timers for the different time domains don't clash. */
     @Test
-    public void testProcessingTimeAndEventTimeDontInterfere() throws Exception {
+    void testProcessingTimeAndEventTimeDontInterfere() throws Exception {
         try (KeyedOneInputStreamOperatorTestHarness<Integer, Tuple2<Integer, String>, String>
                 testHarness = createTestHarness()) {
             testHarness.open();
@@ -231,11 +228,11 @@ public class AbstractStreamOperatorTest {
 
             testHarness.processWatermark(20L);
 
-            assertThat(extractResult(testHarness), contains("ON_EVENT_TIME:HELLO"));
+            assertThat(extractResult(testHarness)).contains("ON_EVENT_TIME:HELLO");
 
             testHarness.setProcessingTime(10L);
 
-            assertThat(extractResult(testHarness), contains("ON_PROC_TIME:HELLO"));
+            assertThat(extractResult(testHarness)).contains("ON_PROC_TIME:HELLO");
         }
     }
 
@@ -244,7 +241,7 @@ public class AbstractStreamOperatorTest {
      * assigned to operator subtasks when restoring.
      */
     @Test
-    public void testStateAndTimerStateShufflingScalingUp() throws Exception {
+    void testStateAndTimerStateShufflingScalingUp() throws Exception {
         final int maxParallelism = 10;
 
         // first get two keys that will fall into different key-group ranges that go
@@ -277,7 +274,7 @@ public class AbstractStreamOperatorTest {
             testHarness.processElement(new Tuple2<>(key1, "SET_STATE:HELLO"), 0);
             testHarness.processElement(new Tuple2<>(key2, "SET_STATE:CIAO"), 0);
 
-            assertTrue(extractResult(testHarness).isEmpty());
+            assertThat(extractResult(testHarness)).isEmpty();
 
             snapshot = testHarness.snapshot(0, 0);
         }
@@ -295,27 +292,27 @@ public class AbstractStreamOperatorTest {
 
             testHarness1.processWatermark(10L);
 
-            assertThat(extractResult(testHarness1), contains("ON_EVENT_TIME:HELLO"));
+            assertThat(extractResult(testHarness1)).contains("ON_EVENT_TIME:HELLO");
 
-            assertTrue(extractResult(testHarness1).isEmpty());
+            assertThat(extractResult(testHarness1)).isEmpty();
 
             // this should not trigger anything, the trigger for WM=20 should sit in the
             // other operator subtask
             testHarness1.processWatermark(20L);
 
-            assertTrue(extractResult(testHarness1).isEmpty());
+            assertThat(extractResult(testHarness1)).isEmpty();
 
             testHarness1.setProcessingTime(10L);
 
-            assertThat(extractResult(testHarness1), contains("ON_PROC_TIME:HELLO"));
+            assertThat(extractResult(testHarness1)).contains("ON_PROC_TIME:HELLO");
 
-            assertTrue(extractResult(testHarness1).isEmpty());
+            assertThat(extractResult(testHarness1)).isEmpty();
 
             // this should not trigger anything, the trigger for TIME=20 should sit in the
             // other operator subtask
             testHarness1.setProcessingTime(20L);
 
-            assertTrue(extractResult(testHarness1).isEmpty());
+            assertThat(extractResult(testHarness1)).isEmpty();
         }
 
         // now, for the second operator
@@ -332,27 +329,27 @@ public class AbstractStreamOperatorTest {
             testHarness2.processWatermark(10L);
 
             // nothing should happen because this timer is in the other subtask
-            assertTrue(extractResult(testHarness2).isEmpty());
+            assertThat(extractResult(testHarness2)).isEmpty();
 
             testHarness2.processWatermark(20L);
 
-            assertThat(extractResult(testHarness2), contains("ON_EVENT_TIME:CIAO"));
+            assertThat(extractResult(testHarness2)).contains("ON_EVENT_TIME:CIAO");
 
             testHarness2.setProcessingTime(10L);
 
             // nothing should happen because this timer is in the other subtask
-            assertTrue(extractResult(testHarness2).isEmpty());
+            assertThat(extractResult(testHarness2)).isEmpty();
 
             testHarness2.setProcessingTime(20L);
 
-            assertThat(extractResult(testHarness2), contains("ON_PROC_TIME:CIAO"));
+            assertThat(extractResult(testHarness2)).contains("ON_PROC_TIME:CIAO");
 
-            assertTrue(extractResult(testHarness2).isEmpty());
+            assertThat(extractResult(testHarness2)).isEmpty();
         }
     }
 
     @Test
-    public void testStateAndTimerStateShufflingScalingDown() throws Exception {
+    void testStateAndTimerStateShufflingScalingDown() throws Exception {
         final int maxParallelism = 10;
 
         // first get two keys that will fall into different key-group ranges that go
@@ -416,25 +413,25 @@ public class AbstractStreamOperatorTest {
             testHarness3.open();
 
             testHarness3.processWatermark(30L);
-            assertThat(extractResult(testHarness3), contains("ON_EVENT_TIME:HELLO"));
-            assertTrue(extractResult(testHarness3).isEmpty());
+            assertThat(extractResult(testHarness3)).contains("ON_EVENT_TIME:HELLO");
+            assertThat(extractResult(testHarness3)).isEmpty();
 
             testHarness3.processWatermark(40L);
-            assertThat(extractResult(testHarness3), contains("ON_EVENT_TIME:CIAO"));
-            assertTrue(extractResult(testHarness3).isEmpty());
+            assertThat(extractResult(testHarness3)).contains("ON_EVENT_TIME:CIAO");
+            assertThat(extractResult(testHarness3)).isEmpty();
 
             testHarness3.setProcessingTime(30L);
-            assertThat(extractResult(testHarness3), contains("ON_PROC_TIME:HELLO"));
-            assertTrue(extractResult(testHarness3).isEmpty());
+            assertThat(extractResult(testHarness3)).contains("ON_PROC_TIME:HELLO");
+            assertThat(extractResult(testHarness3)).isEmpty();
 
             testHarness3.setProcessingTime(40L);
-            assertThat(extractResult(testHarness3), contains("ON_PROC_TIME:CIAO"));
-            assertTrue(extractResult(testHarness3).isEmpty());
+            assertThat(extractResult(testHarness3)).contains("ON_PROC_TIME:CIAO");
+            assertThat(extractResult(testHarness3)).isEmpty();
         }
     }
 
     @Test
-    public void testCustomRawKeyedStateSnapshotAndRestore() throws Exception {
+    void testCustomRawKeyedStateSnapshotAndRestore() throws Exception {
         // setup: 10 key groups, all assigned to single subtask
         final int maxParallelism = 10;
         final int numSubtasks = 1;
@@ -473,13 +470,12 @@ public class AbstractStreamOperatorTest {
             testHarness.open();
         }
 
-        assertThat(
-                testOperator.restoredRawKeyedState,
-                hasRestoredKeyGroupsWith(testSnapshotData, keyGroupsToWrite));
+        assertThat(testOperator.restoredRawKeyedState)
+                .is(matching(hasRestoredKeyGroupsWith(testSnapshotData, keyGroupsToWrite)));
     }
 
     @Test
-    public void testIdleWatermarkHandling() throws Exception {
+    void testIdleWatermarkHandling() throws Exception {
         final WatermarkTestingOperator testOperator = new WatermarkTestingOperator();
 
         ConcurrentLinkedQueue<Object> expectedOutput = new ConcurrentLinkedQueue<>();
@@ -496,7 +492,7 @@ public class AbstractStreamOperatorTest {
             testHarness.processElement1(3L, 3L);
             testHarness.processElement1(4L, 4L);
             testHarness.processWatermark1(new Watermark(1L));
-            assertThat(testHarness.getOutput(), empty());
+            assertThat(testHarness.getOutput()).isEmpty();
 
             testHarness.processWatermarkStatus2(WatermarkStatus.IDLE);
             expectedOutput.add(new StreamRecord<>(1L));
@@ -519,7 +515,7 @@ public class AbstractStreamOperatorTest {
     }
 
     @Test
-    public void testIdlenessForwarding() throws Exception {
+    void testIdlenessForwarding() throws Exception {
         final WatermarkTestingOperator testOperator = new WatermarkTestingOperator();
         ConcurrentLinkedQueue<Object> expectedOutput = new ConcurrentLinkedQueue<>();
         KeySelector<Long, Integer> dummyKeySelector = l -> 0;
@@ -541,7 +537,7 @@ public class AbstractStreamOperatorTest {
     }
 
     @Test
-    public void testTwoInputsRecordAttributesForwarding() throws Exception {
+    void testTwoInputsRecordAttributesForwarding() throws Exception {
         final WatermarkTestingOperator testOperator = new WatermarkTestingOperator();
         ConcurrentLinkedQueue<Object> expectedOutput = new ConcurrentLinkedQueue<>();
         KeySelector<Long, Integer> dummyKeySelector = l -> 0;
@@ -575,7 +571,7 @@ public class AbstractStreamOperatorTest {
     }
 
     @Test
-    public void testOneInputRecordAttributesForwarding() throws Exception {
+    void testOneInputRecordAttributesForwarding() throws Exception {
         ConcurrentLinkedQueue<Object> expectedOutput = new ConcurrentLinkedQueue<>();
         try (KeyedOneInputStreamOperatorTestHarness<Integer, Tuple2<Integer, String>, String>
                 testHarness = createTestHarness()) {
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/AbstractStreamOperatorV2Test.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/AbstractStreamOperatorV2Test.java
index c6f7a3d28ea..40c6a716891 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/AbstractStreamOperatorV2Test.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/AbstractStreamOperatorV2Test.java
@@ -34,18 +34,17 @@ import org.apache.flink.streaming.util.KeyedMultiInputStreamOperatorTestHarness;
 import org.apache.flink.streaming.util.KeyedOneInputStreamOperatorTestHarness;
 import org.apache.flink.streaming.util.TestHarnessUtil;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 import java.util.concurrent.ConcurrentLinkedQueue;
 
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.empty;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /** Tests for the facilities provided by {@link AbstractStreamOperatorV2}. */
-public class AbstractStreamOperatorV2Test extends AbstractStreamOperatorTest {
+class AbstractStreamOperatorV2Test extends AbstractStreamOperatorTest {
     @Override
     protected KeyedOneInputStreamOperatorTestHarness<Integer, Tuple2<Integer, String>, String>
             createTestHarness(int maxParalelism, int numSubtasks, int subtaskIndex)
@@ -73,7 +72,7 @@ public class AbstractStreamOperatorV2Test extends AbstractStreamOperatorTest {
     }
 
     @Test
-    public void testIdleWatermarkHandling() throws Exception {
+    void testIdleWatermarkHandling() throws Exception {
         ConcurrentLinkedQueue<Object> expectedOutput = new ConcurrentLinkedQueue<>();
         KeySelector<Long, Integer> dummyKeySelector = l -> 0;
         try (KeyedMultiInputStreamOperatorTestHarness<Integer, Long> testHarness =
@@ -88,7 +87,7 @@ public class AbstractStreamOperatorV2Test extends AbstractStreamOperatorTest {
             testHarness.processElement(0, new StreamRecord<>(3L, 3L));
             testHarness.processElement(0, new StreamRecord<>(4L, 4L));
             testHarness.processWatermark(0, new Watermark(1L));
-            assertThat(testHarness.getOutput(), empty());
+            assertThat(testHarness.getOutput()).isEmpty();
 
             testHarness.processWatermarkStatus(1, WatermarkStatus.IDLE);
             TestHarnessUtil.assertOutputEquals(
@@ -114,7 +113,7 @@ public class AbstractStreamOperatorV2Test extends AbstractStreamOperatorTest {
     }
 
     @Test
-    public void testIdlenessForwarding() throws Exception {
+    void testIdlenessForwarding() throws Exception {
         ConcurrentLinkedQueue<Object> expectedOutput = new ConcurrentLinkedQueue<>();
         try (KeyedMultiInputStreamOperatorTestHarness<Integer, Long> testHarness =
                 new KeyedMultiInputStreamOperatorTestHarness<>(
@@ -134,7 +133,7 @@ public class AbstractStreamOperatorV2Test extends AbstractStreamOperatorTest {
     }
 
     @Test
-    public void testRecordAttributesForwarding() throws Exception {
+    void testRecordAttributesForwarding() throws Exception {
         ConcurrentLinkedQueue<Object> expectedOutput = new ConcurrentLinkedQueue<>();
         try (KeyedMultiInputStreamOperatorTestHarness<Integer, Long> testHarness =
                 new KeyedMultiInputStreamOperatorTestHarness<>(
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/AbstractUdfStreamOperatorLifecycleTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/AbstractUdfStreamOperatorLifecycleTest.java
index 6833271f728..e91f7e9fc03 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/AbstractUdfStreamOperatorLifecycleTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/AbstractUdfStreamOperatorLifecycleTest.java
@@ -42,11 +42,10 @@ import org.apache.flink.streaming.runtime.tasks.SourceStreamTask;
 import org.apache.flink.streaming.runtime.tasks.StreamTask;
 import org.apache.flink.streaming.runtime.tasks.StreamTaskTest;
 import org.apache.flink.testutils.TestingUtils;
-import org.apache.flink.testutils.executor.TestExecutorResource;
+import org.apache.flink.testutils.executor.TestExecutorExtension;
 
-import org.junit.Assert;
-import org.junit.ClassRule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.Serializable;
 import java.lang.reflect.Method;
@@ -56,13 +55,15 @@ import java.util.Collections;
 import java.util.List;
 import java.util.concurrent.ScheduledExecutorService;
 
-import static org.junit.Assert.assertEquals;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.fail;
 
 /** This test secures the lifecycle of AbstractUdfStreamOperator, including it's UDF handling. */
-public class AbstractUdfStreamOperatorLifecycleTest {
-    @ClassRule
-    public static final TestExecutorResource<ScheduledExecutorService> EXECUTOR_RESOURCE =
-            TestingUtils.defaultExecutorResource();
+class AbstractUdfStreamOperatorLifecycleTest {
+
+    @RegisterExtension
+    private static final TestExecutorExtension<ScheduledExecutorService> EXECUTOR_RESOURCE =
+            TestingUtils.defaultExecutorExtension();
 
     private static final List<String> EXPECTED_CALL_ORDER_FULL =
             Arrays.asList(
@@ -120,20 +121,20 @@ public class AbstractUdfStreamOperatorLifecycleTest {
             Collections.synchronizedList(new ArrayList<String>(EXPECTED_CALL_ORDER_FULL.size()));
 
     @Test
-    public void testAllMethodsRegisteredInTest() {
+    void testAllMethodsRegisteredInTest() {
         List<String> methodsWithSignatureString = new ArrayList<>();
         for (Method method : StreamOperator.class.getMethods()) {
             methodsWithSignatureString.add(
                     method.getName() + Arrays.toString(method.getParameterTypes()));
         }
         Collections.sort(methodsWithSignatureString);
-        Assert.assertEquals(
-                "It seems like new methods have been introduced to "
-                        + StreamOperator.class
-                        + ". Please register them with this test and ensure to document their position in the lifecycle "
-                        + "(if applicable).",
-                ALL_METHODS_STREAM_OPERATOR,
-                methodsWithSignatureString.toString());
+        assertThat(methodsWithSignatureString)
+                .as(
+                        "It seems like new methods have been introduced to "
+                                + StreamOperator.class
+                                + ". Please register them with this test and ensure to document their position in the lifecycle "
+                                + "(if applicable).")
+                .hasToString(ALL_METHODS_STREAM_OPERATOR);
 
         methodsWithSignatureString = new ArrayList<>();
         for (Method method : RichFunction.class.getMethods()) {
@@ -141,17 +142,17 @@ public class AbstractUdfStreamOperatorLifecycleTest {
                     method.getName() + Arrays.toString(method.getParameterTypes()));
         }
         Collections.sort(methodsWithSignatureString);
-        Assert.assertEquals(
-                "It seems like new methods have been introduced to "
-                        + RichFunction.class
-                        + ". Please register them with this test and ensure to document their position in the lifecycle "
-                        + "(if applicable).",
-                ALL_METHODS_RICH_FUNCTION,
-                methodsWithSignatureString.toString());
+        assertThat(methodsWithSignatureString)
+                .as(
+                        "It seems like new methods have been introduced to "
+                                + RichFunction.class
+                                + ". Please register them with this test and ensure to document their position in the lifecycle "
+                                + "(if applicable).")
+                .hasToString(ALL_METHODS_RICH_FUNCTION);
     }
 
     @Test
-    public void testLifeCycleFull() throws Exception {
+    void testLifeCycleFull() throws Exception {
         ACTUAL_ORDER_TRACKING.clear();
 
         Configuration taskManagerConfig = new Configuration();
@@ -177,13 +178,13 @@ public class AbstractUdfStreamOperatorLifecycleTest {
 
             // wait for clean termination
             task.getExecutingThread().join();
-            assertEquals(ExecutionState.FINISHED, task.getExecutionState());
-            assertEquals(EXPECTED_CALL_ORDER_FULL, ACTUAL_ORDER_TRACKING);
+            assertThat(task.getExecutionState()).isEqualTo(ExecutionState.FINISHED);
+            assertThat(ACTUAL_ORDER_TRACKING).isEqualTo(EXPECTED_CALL_ORDER_FULL);
         }
     }
 
     @Test
-    public void testLifeCycleCancel() throws Exception {
+    void testLifeCycleCancel() throws Exception {
         ACTUAL_ORDER_TRACKING.clear();
 
         Configuration taskManagerConfig = new Configuration();
@@ -210,8 +211,8 @@ public class AbstractUdfStreamOperatorLifecycleTest {
 
             // wait for clean termination
             task.getExecutingThread().join();
-            assertEquals(ExecutionState.CANCELED, task.getExecutionState());
-            assertEquals(EXPECTED_CALL_ORDER_CANCEL_RUNNING, ACTUAL_ORDER_TRACKING);
+            assertThat(task.getExecutionState()).isEqualTo(ExecutionState.CANCELED);
+            assertThat(ACTUAL_ORDER_TRACKING).isEqualTo(EXPECTED_CALL_ORDER_CANCEL_RUNNING);
         }
     }
 
@@ -303,8 +304,7 @@ public class AbstractUdfStreamOperatorLifecycleTest {
                                         LifecycleTrackingStreamSource.runFinish.trigger();
                                     }
                                 } catch (Exception e) {
-                                    e.printStackTrace();
-                                    Assert.fail();
+                                    fail(e);
                                 }
                             }
                         };
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/BackendRestorerProcedureTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/BackendRestorerProcedureTest.java
index 1e0fe548212..b6e36e2c811 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/BackendRestorerProcedureTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/BackendRestorerProcedureTest.java
@@ -34,11 +34,9 @@ import org.apache.flink.runtime.state.StateObject;
 import org.apache.flink.runtime.state.memory.MemCheckpointStreamFactory;
 import org.apache.flink.runtime.util.BlockingFSDataInputStream;
 import org.apache.flink.util.FlinkException;
-import org.apache.flink.util.TestLogger;
 import org.apache.flink.util.function.FunctionWithException;
 
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import java.util.Arrays;
 import java.util.Collection;
@@ -48,6 +46,8 @@ import java.util.List;
 import java.util.concurrent.RunnableFuture;
 import java.util.concurrent.atomic.AtomicReference;
 
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.times;
@@ -55,7 +55,7 @@ import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
 /** Tests for {@link BackendRestorerProcedure}. */
-public class BackendRestorerProcedureTest extends TestLogger {
+class BackendRestorerProcedureTest {
 
     private final FunctionWithException<
                     Collection<OperatorStateHandle>, OperatorStateBackend, Exception>
@@ -74,7 +74,7 @@ public class BackendRestorerProcedureTest extends TestLogger {
      * attempts if there are more options.
      */
     @Test
-    public void testRestoreProcedureOrderAndFailure() throws Exception {
+    void testRestoreProcedureOrderAndFailure() throws Exception {
 
         CloseableRegistry closeableRegistry = new CloseableRegistry();
         CheckpointStreamFactory checkpointStreamFactory = new MemCheckpointStreamFactory(1024);
@@ -124,7 +124,7 @@ public class BackendRestorerProcedureTest extends TestLogger {
         OperatorStateBackend restoredBackend =
                 restorerProcedure.createAndRestore(
                         sortedRestoreOptions, StateObject.StateObjectSizeStatsCollector.create());
-        Assert.assertNotNull(restoredBackend);
+        assertThat(restoredBackend).isNotNull();
 
         try {
             verify(firstFailHandle).openInputStream();
@@ -134,11 +134,11 @@ public class BackendRestorerProcedureTest extends TestLogger {
             ListState<Integer> listState = restoredBackend.getListState(stateDescriptor);
 
             Iterator<Integer> stateIterator = listState.get().iterator();
-            Assert.assertEquals(0, (int) stateIterator.next());
-            Assert.assertEquals(1, (int) stateIterator.next());
-            Assert.assertEquals(2, (int) stateIterator.next());
-            Assert.assertEquals(3, (int) stateIterator.next());
-            Assert.assertFalse(stateIterator.hasNext());
+            assertThat(stateIterator.next()).isZero();
+            assertThat(stateIterator.next()).isOne();
+            assertThat(stateIterator.next()).isEqualTo(2);
+            assertThat(stateIterator.next()).isEqualTo(3);
+            assertThat(stateIterator).isExhausted();
 
         } finally {
             restoredBackend.close();
@@ -148,7 +148,7 @@ public class BackendRestorerProcedureTest extends TestLogger {
 
     /** Tests if there is an exception if all restore attempts are exhausted and failed. */
     @Test
-    public void testExceptionThrownIfAllRestoresFailed() throws Exception {
+    void testExceptionThrownIfAllRestoresFailed() throws Exception {
 
         CloseableRegistry closeableRegistry = new CloseableRegistry();
 
@@ -166,12 +166,12 @@ public class BackendRestorerProcedureTest extends TestLogger {
                 new BackendRestorerProcedure<>(
                         backendSupplier, closeableRegistry, "test op state backend");
 
-        try {
-            restorerProcedure.createAndRestore(
-                    sortedRestoreOptions, StateObject.StateObjectSizeStatsCollector.create());
-            Assert.fail();
-        } catch (Exception ignore) {
-        }
+        assertThatThrownBy(
+                        () ->
+                                restorerProcedure.createAndRestore(
+                                        sortedRestoreOptions,
+                                        StateObject.StateObjectSizeStatsCollector.create()))
+                .isInstanceOf(FlinkException.class);
 
         verify(firstFailHandle).openInputStream();
         verify(secondFailHandle).openInputStream();
@@ -180,7 +180,7 @@ public class BackendRestorerProcedureTest extends TestLogger {
 
     /** Test that the restore can be stopped via the provided closeable registry. */
     @Test
-    public void testCanBeCanceledViaRegistry() throws Exception {
+    void testCanBeCanceledViaRegistry() throws Exception {
         CloseableRegistry closeableRegistry = new CloseableRegistry();
         OneShotLatch waitForBlock = new OneShotLatch();
         OneShotLatch unblock = new OneShotLatch();
@@ -217,6 +217,6 @@ public class BackendRestorerProcedureTest extends TestLogger {
         restoreThread.join();
 
         Exception exception = exceptionReference.get();
-        Assert.assertTrue(exception instanceof FlinkException);
+        assertThat(exception).isInstanceOf(FlinkException.class);
     }
 }
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/BatchGroupedReduceOperatorTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/BatchGroupedReduceOperatorTest.java
index b7188ec0e34..0430340b150 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/BatchGroupedReduceOperatorTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/BatchGroupedReduceOperatorTest.java
@@ -24,25 +24,18 @@ import org.apache.flink.api.common.typeutils.base.StringSerializer;
 import org.apache.flink.streaming.api.watermark.Watermark;
 import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
 import org.apache.flink.streaming.util.KeyedOneInputStreamOperatorTestHarness;
-import org.apache.flink.util.TestLogger;
 
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
 
 import java.util.ArrayDeque;
 
-import static org.hamcrest.Matchers.contains;
-import static org.hamcrest.Matchers.empty;
-import static org.junit.Assert.assertThat;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /** Tests {@link BatchGroupedReduceOperator}. */
-public class BatchGroupedReduceOperatorTest extends TestLogger {
-
-    @Rule public ExpectedException expectedException = ExpectedException.none();
+class BatchGroupedReduceOperatorTest {
 
     @Test
-    public void noIncrementalResults() throws Exception {
+    void noIncrementalResults() throws Exception {
         KeyedOneInputStreamOperatorTestHarness<String, String, String> testHarness =
                 createTestHarness();
 
@@ -51,11 +44,11 @@ public class BatchGroupedReduceOperatorTest extends TestLogger {
         testHarness.processElement(new StreamRecord<>("ciao"));
         testHarness.processElement(new StreamRecord<>("ciao"));
 
-        assertThat(testHarness.getOutput(), empty());
+        assertThat(testHarness.getOutput()).isEmpty();
     }
 
     @Test
-    public void resultsOnMaxWatermark() throws Exception {
+    void resultsOnMaxWatermark() throws Exception {
         KeyedOneInputStreamOperatorTestHarness<String, String, String> testHarness =
                 createTestHarness();
 
@@ -72,11 +65,11 @@ public class BatchGroupedReduceOperatorTest extends TestLogger {
         expectedOutput.add(new StreamRecord<>("ciaociaociao", Long.MAX_VALUE));
         expectedOutput.add(new Watermark(Long.MAX_VALUE));
 
-        assertThat(testHarness.getOutput(), contains(expectedOutput.toArray()));
+        assertThat(testHarness.getOutput()).contains(expectedOutput.toArray());
     }
 
     @Test
-    public void resultForSingleInput() throws Exception {
+    void resultForSingleInput() throws Exception {
         KeyedOneInputStreamOperatorTestHarness<String, String, String> testHarness =
                 createTestHarness();
 
@@ -90,7 +83,7 @@ public class BatchGroupedReduceOperatorTest extends TestLogger {
         expectedOutput.add(new StreamRecord<>("ciao", Long.MAX_VALUE));
         expectedOutput.add(new Watermark(Long.MAX_VALUE));
 
-        assertThat(testHarness.getOutput(), contains(expectedOutput.toArray()));
... 8176 lines suppressed ...