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 138f1f9d17b [FLINK-25537][JUnit5 Migration] Module flink-core with 
package configuration
138f1f9d17b is described below

commit 138f1f9d17b7a58b092ee7d9fc4c20d968a7b33b
Author: gongzhongqiang <[email protected]>
AuthorDate: Tue Apr 16 09:09:34 2024 +0800

    [FLINK-25537][JUnit5 Migration] Module flink-core with package configuration
---
 .../flink/configuration/ConfigOptionTest.java      |  50 ++--
 .../flink/configuration/ConfigUtilsTest.java       |  46 ++--
 .../ConfigurationConversionsTest.java              | 112 ++++----
 .../ConfigurationParsingInvalidFormatsTest.java    |  64 ++---
 .../flink/configuration/ConfigurationTest.java     | 161 +++++------
 .../configuration/ConfigurationUtilsTest.java      |   6 +-
 .../flink/configuration/CoreOptionsTest.java       |  23 +-
 .../configuration/FilesystemSchemeConfigTest.java  |  64 ++---
 .../configuration/GlobalConfigurationTest.java     |  93 +++----
 .../MemorySizePrettyPrintingTest.java              |  33 +--
 .../apache/flink/configuration/MemorySizeTest.java | 300 ++++++++++-----------
 .../configuration/ParentFirstPatternsTest.java     |  36 ++-
 .../ReadableWritableConfigurationTest.java         |  19 +-
 .../flink/configuration/RestOptionsTest.java       |  18 +-
 .../flink/configuration/SecurityOptionsTest.java   |  31 +--
 .../StructuredOptionsSplitterEscapeTest.java       |  28 +-
 .../StructuredOptionsSplitterTest.java             |  50 ++--
 .../UnmodifiableConfigurationTest.java             |  85 +++---
 .../flink/configuration/YamlParserUtilsTest.java   |  15 +-
 .../description/DescriptionHtmlTest.java           |  53 ++--
 20 files changed, 604 insertions(+), 683 deletions(-)

diff --git 
a/flink-core/src/test/java/org/apache/flink/configuration/ConfigOptionTest.java 
b/flink-core/src/test/java/org/apache/flink/configuration/ConfigOptionTest.java
index 1acc8ad46ed..a4e5d81478d 100644
--- 
a/flink-core/src/test/java/org/apache/flink/configuration/ConfigOptionTest.java
+++ 
b/flink-core/src/test/java/org/apache/flink/configuration/ConfigOptionTest.java
@@ -18,11 +18,9 @@
 
 package org.apache.flink.configuration;
 
-import org.apache.flink.util.TestLogger;
-
 import org.apache.flink.shaded.guava31.com.google.common.collect.Sets;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -30,45 +28,45 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
-import static org.hamcrest.Matchers.containsInAnyOrder;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /** Tests for the {@link ConfigOption}. */
-public class ConfigOptionTest extends TestLogger {
+class ConfigOptionTest {
 
     @Test
-    public void testDeprecationFlagForDeprecatedKeys() {
+    void testDeprecationFlagForDeprecatedKeys() {
         final ConfigOption<Integer> optionWithDeprecatedKeys =
                 ConfigOptions.key("key")
                         .intType()
                         .defaultValue(0)
                         .withDeprecatedKeys("deprecated1", "deprecated2");
 
-        assertTrue(optionWithDeprecatedKeys.hasFallbackKeys());
+        assertThat(optionWithDeprecatedKeys.hasFallbackKeys()).isTrue();
         for (final FallbackKey fallbackKey : 
optionWithDeprecatedKeys.fallbackKeys()) {
-            assertTrue("deprecated key not flagged as deprecated", 
fallbackKey.isDeprecated());
+            assertThat(fallbackKey.isDeprecated())
+                    .as("deprecated key not flagged as deprecated")
+                    .isTrue();
         }
     }
 
     @Test
-    public void testDeprecationFlagForFallbackKeys() {
+    void testDeprecationFlagForFallbackKeys() {
         final ConfigOption<Integer> optionWithFallbackKeys =
                 ConfigOptions.key("key")
                         .intType()
                         .defaultValue(0)
                         .withFallbackKeys("fallback1", "fallback2");
 
-        assertTrue(optionWithFallbackKeys.hasFallbackKeys());
+        assertThat(optionWithFallbackKeys.hasFallbackKeys()).isTrue();
         for (final FallbackKey fallbackKey : 
optionWithFallbackKeys.fallbackKeys()) {
-            assertFalse("falback key flagged as deprecated", 
fallbackKey.isDeprecated());
+            assertThat(fallbackKey.isDeprecated())
+                    .as("falback key flagged as deprecated")
+                    .isFalse();
         }
     }
 
     @Test
-    public void testDeprecationFlagForMixedAlternativeKeys() {
+    void testDeprecationFlagForMixedAlternativeKeys() {
         final ConfigOption<Integer> optionWithMixedKeys =
                 ConfigOptions.key("key")
                         .intType()
@@ -86,15 +84,15 @@ public class ConfigOptionTest extends TestLogger {
             }
         }
 
-        assertEquals(2, fallbackKeys.size());
-        assertEquals(2, deprecatedKeys.size());
+        assertThat(fallbackKeys).hasSize(2);
+        assertThat(deprecatedKeys).hasSize(2);
 
-        assertThat(fallbackKeys, containsInAnyOrder("fallback1", "fallback2"));
-        assertThat(deprecatedKeys, containsInAnyOrder("deprecated1", 
"deprecated2"));
+        assertThat(fallbackKeys).containsExactlyInAnyOrder("fallback1", 
"fallback2");
+        assertThat(deprecatedKeys).containsExactlyInAnyOrder("deprecated1", 
"deprecated2");
     }
 
     @Test
-    public void testDeprecationForDeprecatedKeys() {
+    void testDeprecationForDeprecatedKeys() {
         String[] deprecatedKeys = new String[] {"deprecated1", "deprecated2"};
         final Set<String> expectedDeprecatedKeys = new 
HashSet<>(Arrays.asList(deprecatedKeys));
 
@@ -105,16 +103,16 @@ public class ConfigOptionTest extends TestLogger {
                         .withDeprecatedKeys(deprecatedKeys)
                         .withFallbackKeys("fallback1");
 
-        assertTrue(optionWithDeprecatedKeys.hasDeprecatedKeys());
-        assertEquals(
-                expectedDeprecatedKeys, 
Sets.newHashSet(optionWithDeprecatedKeys.deprecatedKeys()));
+        assertThat(optionWithDeprecatedKeys.hasDeprecatedKeys()).isTrue();
+        assertThat(Sets.newHashSet(optionWithDeprecatedKeys.deprecatedKeys()))
+                .isEqualTo(expectedDeprecatedKeys);
     }
 
     @Test
-    public void testNoDeprecationForFallbackKeysWithoutDeprecated() {
+    void testNoDeprecationForFallbackKeysWithoutDeprecated() {
         final ConfigOption<Integer> optionWithFallbackKeys =
                 
ConfigOptions.key("key").intType().defaultValue(0).withFallbackKeys("fallback1");
 
-        assertFalse(optionWithFallbackKeys.hasDeprecatedKeys());
+        assertThat(optionWithFallbackKeys.hasDeprecatedKeys()).isFalse();
     }
 }
diff --git 
a/flink-core/src/test/java/org/apache/flink/configuration/ConfigUtilsTest.java 
b/flink-core/src/test/java/org/apache/flink/configuration/ConfigUtilsTest.java
index ad85505e8fd..bb467d81fc5 100644
--- 
a/flink-core/src/test/java/org/apache/flink/configuration/ConfigUtilsTest.java
+++ 
b/flink-core/src/test/java/org/apache/flink/configuration/ConfigUtilsTest.java
@@ -18,21 +18,17 @@
 
 package org.apache.flink.configuration;
 
-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.apache.flink.configuration.ConfigOptions.key;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.hamcrest.Matchers.empty;
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsEqual.equalTo;
-import static org.junit.Assert.assertThat;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /** Tests the {@link ConfigUtils} methods. */
-public class ConfigUtilsTest {
+class ConfigUtilsTest {
 
     private static final ConfigOption<List<String>> TEST_OPTION =
             key("test.option.key").stringType().asList().noDefaultValue();
@@ -41,7 +37,7 @@ public class ConfigUtilsTest {
     private static final List<Integer> intList = Arrays.asList(intArray);
 
     @Test
-    public void collectionIsCorrectlyPutAndFetched() {
+    void collectionIsCorrectlyPutAndFetched() {
         final Configuration configurationUnderTest = new Configuration();
         ConfigUtils.encodeCollectionToConfig(
                 configurationUnderTest, TEST_OPTION, intList, 
Object::toString);
@@ -49,11 +45,11 @@ public class ConfigUtilsTest {
         final List<Integer> recovered =
                 ConfigUtils.decodeListFromConfig(
                         configurationUnderTest, TEST_OPTION, Integer::valueOf);
-        assertThat(recovered, equalTo(intList));
+        assertThat(recovered).isEqualTo(intList);
     }
 
     @Test
-    public void arrayIsCorrectlyPutAndFetched() {
+    void arrayIsCorrectlyPutAndFetched() {
         final Configuration configurationUnderTest = new Configuration();
         ConfigUtils.encodeArrayToConfig(
                 configurationUnderTest, TEST_OPTION, intArray, 
Object::toString);
@@ -61,70 +57,70 @@ public class ConfigUtilsTest {
         final List<Integer> recovered =
                 ConfigUtils.decodeListFromConfig(
                         configurationUnderTest, TEST_OPTION, Integer::valueOf);
-        assertThat(recovered, equalTo(intList));
+        assertThat(recovered).isEqualTo(intList);
     }
 
     @Test
-    public void nullCollectionPutsNothingInConfig() {
+    void nullCollectionPutsNothingInConfig() {
         final Configuration configurationUnderTest = new Configuration();
         ConfigUtils.encodeCollectionToConfig(
                 configurationUnderTest, TEST_OPTION, null, Object::toString);
 
-        assertThat(configurationUnderTest.keySet(), is(empty()));
+        assertThat(configurationUnderTest.keySet()).isEmpty();
 
         final Object recovered = configurationUnderTest.get(TEST_OPTION);
-        assertThat(recovered, is(nullValue()));
+        assertThat(recovered).isNull();
 
         final List<Integer> recoveredList =
                 ConfigUtils.decodeListFromConfig(
                         configurationUnderTest, TEST_OPTION, Integer::valueOf);
-        assertThat(recoveredList, is(empty()));
+        assertThat(recoveredList).isEmpty();
     }
 
     @Test
-    public void nullArrayPutsNothingInConfig() {
+    void nullArrayPutsNothingInConfig() {
         final Configuration configurationUnderTest = new Configuration();
         ConfigUtils.encodeArrayToConfig(
                 configurationUnderTest, TEST_OPTION, null, Object::toString);
 
-        assertThat(configurationUnderTest.keySet(), is(empty()));
+        assertThat(configurationUnderTest.keySet()).isEmpty();
 
         final Object recovered = configurationUnderTest.get(TEST_OPTION);
-        assertThat(recovered, is(nullValue()));
+        assertThat(recovered).isNull();
 
         final List<Integer> recoveredList =
                 ConfigUtils.decodeListFromConfig(
                         configurationUnderTest, TEST_OPTION, Integer::valueOf);
-        assertThat(recoveredList, is(empty()));
+        assertThat(recoveredList).isEmpty();
     }
 
     @Test
-    public void emptyCollectionPutsEmptyValueInConfig() {
+    void emptyCollectionPutsEmptyValueInConfig() {
         final Configuration configurationUnderTest = new Configuration();
         ConfigUtils.encodeCollectionToConfig(
                 configurationUnderTest, TEST_OPTION, Collections.emptyList(), 
Object::toString);
 
         final List<String> recovered = configurationUnderTest.get(TEST_OPTION);
-        assertThat(recovered, is(empty()));
+        assertThat(recovered).isEmpty();
 
         final List<Integer> recoveredList =
                 ConfigUtils.decodeListFromConfig(
                         configurationUnderTest, TEST_OPTION, Integer::valueOf);
-        assertThat(recoveredList, is(empty()));
+        assertThat(recoveredList).isEmpty();
     }
 
     @Test
-    public void emptyArrayPutsEmptyValueInConfig() {
+    void emptyArrayPutsEmptyValueInConfig() {
         final Configuration configurationUnderTest = new Configuration();
         ConfigUtils.encodeArrayToConfig(
                 configurationUnderTest, TEST_OPTION, new Integer[5], 
Object::toString);
 
         final List<String> recovered = configurationUnderTest.get(TEST_OPTION);
-        assertThat(recovered, is(empty()));
+        assertThat(recovered).isEmpty();
 
         final List<Integer> recoveredList =
                 ConfigUtils.decodeListFromConfig(
                         configurationUnderTest, TEST_OPTION, Integer::valueOf);
-        assertThat(recoveredList, is(empty()));
+        assertThat(recoveredList).isEmpty();
     }
 }
diff --git 
a/flink-core/src/test/java/org/apache/flink/configuration/ConfigurationConversionsTest.java
 
b/flink-core/src/test/java/org/apache/flink/configuration/ConfigurationConversionsTest.java
index d79f098d922..c88f1037bf7 100644
--- 
a/flink-core/src/test/java/org/apache/flink/configuration/ConfigurationConversionsTest.java
+++ 
b/flink-core/src/test/java/org/apache/flink/configuration/ConfigurationConversionsTest.java
@@ -18,33 +18,32 @@
 
 package org.apache.flink.configuration;
 
-import org.hamcrest.Description;
-import org.hamcrest.Matcher;
-import org.hamcrest.TypeSafeMatcher;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+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.assertj.core.api.Condition;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.TestTemplate;
+import org.junit.jupiter.api.extension.ExtendWith;
 
 import javax.annotation.Nullable;
 
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Objects;
 import java.util.Optional;
 
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.CoreMatchers.startsWith;
-import static org.hamcrest.Matchers.closeTo;
-import static org.junit.Assert.assertThat;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 /**
  * Tests for {@link Configuration} conversion between types. Extracted from 
{@link
  * ConfigurationTest}.
  */
-@RunWith(Parameterized.class)
-public class ConfigurationConversionsTest {
+@SuppressWarnings("deprecation")
+@ExtendWith(ParameterizedTestExtension.class)
+class ConfigurationConversionsTest {
 
     private static final byte[] EMPTY_BYTES = new byte[0];
     private static final long TOO_LONG = Integer.MAX_VALUE + 10L;
@@ -52,8 +51,10 @@ public class ConfigurationConversionsTest {
 
     private Configuration pc;
 
-    @Before
-    public void init() {
+    @Parameter private TestSpec testSpec;
+
+    @BeforeEach
+    void init() {
         pc = new Configuration();
 
         pc.setInteger("int", 5);
@@ -69,10 +70,8 @@ public class ConfigurationConversionsTest {
         pc.setBoolean("boolean", true);
     }
 
-    @Rule public ExpectedException thrown = ExpectedException.none();
-
-    @Parameterized.Parameters
-    public static Collection<TestSpec> getSpecs() {
+    @Parameters(name = "testSpec={0}")
+    private static Collection<TestSpec> getSpecs() {
         return Arrays.asList(
                 // from integer
                 TestSpec.whenAccessed(conf -> conf.getInteger("int", 
0)).expect(5),
@@ -153,12 +152,15 @@ public class ConfigurationConversionsTest {
                                 "For input string: \"2.1456776\"", 
NumberFormatException.class),
                 TestSpec.whenAccessed(conf -> conf.getFloat("float", 
0)).expect(2.1456775f),
                 TestSpec.whenAccessed(conf -> conf.getDouble("float", 0))
-                        .expect(closeTo(2.1456775, 0.0000001)),
+                        .expect(
+                                new Condition<>(
+                                        d -> Math.abs(d - 2.1456775) < 
0.0000001,
+                                        "Expected value")),
                 TestSpec.whenAccessed(conf -> conf.getBoolean("float", true))
                         .expectException(
                                 "Unrecognized option for boolean: 2.1456776. 
Expected either true or false(case insensitive)"),
                 TestSpec.whenAccessed(conf -> conf.getString("float", "0"))
-                        .expect(startsWith("2.145677")),
+                        .expect(new Condition<>(s -> s.startsWith("2.145677"), 
"Expected value")),
                 TestSpec.whenAccessed(conf -> conf.getBytes("float", 
EMPTY_BYTES))
                         .expectException(
                                 "Configuration cannot evaluate value 2.1456776 
as a byte[] value"),
@@ -188,7 +190,7 @@ public class ConfigurationConversionsTest {
                         .expectException(
                                 "Unrecognized option for boolean: 
3.141592653589793. Expected either true or false(case insensitive)"),
                 TestSpec.whenAccessed(conf -> conf.getString("double", "0"))
-                        .expect(startsWith("3.1415926535")),
+                        .expect(new Condition<>(s -> s.startsWith("3.141592"), 
"Expected value")),
                 TestSpec.whenAccessed(conf -> conf.getBytes("double", 
EMPTY_BYTES))
                         .expectException(
                                 "Configuration cannot evaluate value 
3.141592653589793 as a byte[] value"),
@@ -214,7 +216,7 @@ public class ConfigurationConversionsTest {
                         .expectException(
                                 "Unrecognized option for boolean: -1.0. 
Expected either true or false(case insensitive)"),
                 TestSpec.whenAccessed(conf -> 
conf.getString("negative_double", "0"))
-                        .expect(startsWith("-1")),
+                        .expect(new Condition<>(s -> s.startsWith("-1.0"), 
"Expected value")),
                 TestSpec.whenAccessed(conf -> conf.getBytes("negative_double", 
EMPTY_BYTES))
                         .expectException(
                                 "Configuration cannot evaluate value -1.0 as a 
byte[] value"),
@@ -239,7 +241,8 @@ public class ConfigurationConversionsTest {
                 TestSpec.whenAccessed(conf -> conf.getBoolean("zero", true))
                         .expectException(
                                 "Unrecognized option for boolean: 0.0. 
Expected either true or false(case insensitive)"),
-                TestSpec.whenAccessed(conf -> conf.getString("zero", 
"0")).expect(startsWith("0")),
+                TestSpec.whenAccessed(conf -> conf.getString("zero", "0"))
+                        .expect(new Condition<>(s -> s.startsWith("0"), 
"Expected value")),
                 TestSpec.whenAccessed(conf -> conf.getBytes("zero", 
EMPTY_BYTES))
                         .expectException(
                                 "Configuration cannot evaluate value 0.0 as a 
byte[] value"),
@@ -361,22 +364,23 @@ public class ConfigurationConversionsTest {
                                 "Configuration cannot evaluate object of class 
class java.lang.Boolean as a class name"));
     }
 
-    @Parameterized.Parameter public TestSpec<?> testSpec;
+    @TestTemplate
+    void testConversions() throws Exception {
 
-    @Test
-    public void testConversions() throws Exception {
-        testSpec.getExpectedException()
-                .ifPresent(
-                        exception -> {
-                            thrown.expect(testSpec.getExceptionClass());
-                            thrown.expectMessage(exception);
-                        });
+        Optional<String> expectedException = testSpec.getExpectedException();
+
+        if (expectedException.isPresent()) {
+            assertThatThrownBy(() -> testSpec.assertConfiguration(pc))
+                    .isInstanceOf(testSpec.getExceptionClass())
+                    .hasMessageContaining(expectedException.get());
+            return;
+        }
 
         // workaround for type erasure
         testSpec.assertConfiguration(pc);
     }
 
-    private static class IsCloseTo extends TypeSafeMatcher<Float> {
+    private static class IsCloseTo extends Condition<Float> {
         private final float delta;
         private final float value;
 
@@ -385,25 +389,11 @@ public class ConfigurationConversionsTest {
             this.value = value;
         }
 
-        public boolean matchesSafely(Float item) {
+        @Override
+        public boolean matches(Float item) {
             return this.actualDelta(item) <= 0.0D;
         }
 
-        public void describeMismatchSafely(Float item, Description 
mismatchDescription) {
-            mismatchDescription
-                    .appendValue(item)
-                    .appendText(" differed by ")
-                    .appendValue(this.actualDelta(item));
-        }
-
-        public void describeTo(Description description) {
-            description
-                    .appendText("a numeric value within ")
-                    .appendValue(this.delta)
-                    .appendText(" of ")
-                    .appendValue(this.value);
-        }
-
         private double actualDelta(Float item) {
             return Math.abs(item - this.value) - this.delta;
         }
@@ -411,7 +401,7 @@ public class ConfigurationConversionsTest {
 
     private static class TestSpec<T> {
         private final ConfigurationAccessor<T> configurationAccessor;
-        private Matcher<T> matcher;
+        private Condition<T> condition;
         @Nullable private String expectedException = null;
         @Nullable private Class<? extends Exception> exceptionClass;
 
@@ -425,16 +415,17 @@ public class ConfigurationConversionsTest {
         }
 
         public static <T> TestSpec<T> whenAccessed(ConfigurationAccessor<T> 
configurationAccessor) {
-            return new TestSpec<T>(configurationAccessor);
+            return new TestSpec<>(configurationAccessor);
         }
 
-        public TestSpec<T> expect(Matcher<T> expected) {
-            this.matcher = expected;
+        public TestSpec<T> expect(Condition<T> expected) {
+            this.condition = expected;
             return this;
         }
 
         public TestSpec<T> expect(T expected) {
-            this.matcher = equalTo(expected);
+            this.condition =
+                    new Condition<>(value -> Objects.equals(value, expected), 
"Expected value");
             return this;
         }
 
@@ -461,7 +452,12 @@ public class ConfigurationConversionsTest {
         }
 
         void assertConfiguration(Configuration conf) throws Exception {
-            assertThat(configurationAccessor.access(conf), matcher);
+            assertThat(configurationAccessor.access(conf)).is(condition);
+        }
+
+        @Override
+        public String toString() {
+            return String.format("accessor = %s, expected = %s", 
configurationAccessor, condition);
         }
     }
 }
diff --git 
a/flink-core/src/test/java/org/apache/flink/configuration/ConfigurationParsingInvalidFormatsTest.java
 
b/flink-core/src/test/java/org/apache/flink/configuration/ConfigurationParsingInvalidFormatsTest.java
index 26b5bcd8c50..4e20b9c5a9b 100644
--- 
a/flink-core/src/test/java/org/apache/flink/configuration/ConfigurationParsingInvalidFormatsTest.java
+++ 
b/flink-core/src/test/java/org/apache/flink/configuration/ConfigurationParsingInvalidFormatsTest.java
@@ -18,22 +18,24 @@
 
 package org.apache.flink.configuration;
 
-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.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-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.time.Duration;
 import java.util.Collections;
 
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
 /** Tests for reading configuration parameters with invalid formats. */
-@RunWith(Parameterized.class)
-public class ConfigurationParsingInvalidFormatsTest extends TestLogger {
-    @Parameterized.Parameters(name = "option: {0}, invalidString: {1}")
-    public static Object[][] getSpecs() {
+@ExtendWith(ParameterizedTestExtension.class)
+class ConfigurationParsingInvalidFormatsTest {
+
+    @Parameters(name = "option = {0}, invalidString = {1}")
+    private static Object[][] getSpecs() {
         return new Object[][] {
             new Object[] {ConfigOptions.key("int").intType().defaultValue(1), 
"ABC"},
             new Object[] 
{ConfigOptions.key("long").longType().defaultValue(1L), "ABC"},
@@ -64,35 +66,35 @@ public class ConfigurationParsingInvalidFormatsTest extends 
TestLogger {
         };
     }
 
-    @Parameterized.Parameter public ConfigOption<?> option;
-
-    @Parameterized.Parameter(value = 1)
-    public String invalidString;
+    @Parameter private ConfigOption<?> option;
 
-    @Rule public ExpectedException thrown = ExpectedException.none();
+    @Parameter(value = 1)
+    private String invalidString;
 
-    @Test
-    public void testInvalidStringParsingWithGetOptional() {
-        Configuration configuration = new Configuration();
-        configuration.setString(option.key(), invalidString);
-
-        thrown.expect(IllegalArgumentException.class);
-        thrown.expectMessage(
+    @TestTemplate
+    void testInvalidStringParsingWithGetOptional() {
+        assertThrows(
+                IllegalArgumentException.class,
+                () -> {
+                    Configuration configuration = new Configuration();
+                    configuration.setString(option.key(), invalidString);
+                    configuration.getOptional(option);
+                },
                 String.format(
                         "Could not parse value '%s' for key '%s'", 
invalidString, option.key()));
-        configuration.getOptional(option);
     }
 
-    @Test
-    public void testInvalidStringParsingWithGet() {
-        Configuration configuration = new Configuration();
-        configuration.setString(option.key(), invalidString);
-
-        thrown.expect(IllegalArgumentException.class);
-        thrown.expectMessage(
+    @TestTemplate
+    void testInvalidStringParsingWithGet() {
+        assertThrows(
+                IllegalArgumentException.class,
+                () -> {
+                    Configuration configuration = new Configuration();
+                    configuration.setString(option.key(), invalidString);
+                    configuration.get(option);
+                },
                 String.format(
                         "Could not parse value '%s' for key '%s'", 
invalidString, option.key()));
-        configuration.get(option);
     }
 
     private enum TestEnum {
diff --git 
a/flink-core/src/test/java/org/apache/flink/configuration/ConfigurationTest.java
 
b/flink-core/src/test/java/org/apache/flink/configuration/ConfigurationTest.java
index c4a438d78bc..ff6d6bcf9db 100644
--- 
a/flink-core/src/test/java/org/apache/flink/configuration/ConfigurationTest.java
+++ 
b/flink-core/src/test/java/org/apache/flink/configuration/ConfigurationTest.java
@@ -24,11 +24,11 @@ import 
org.apache.flink.testutils.junit.extensions.parameterized.Parameters;
 import org.apache.flink.util.ExceptionUtils;
 import org.apache.flink.util.InstantiationUtil;
 
-import org.assertj.core.api.Assertions;
 import org.assertj.core.data.Offset;
 import org.junit.jupiter.api.TestTemplate;
 import org.junit.jupiter.api.extension.ExtendWith;
 
+import java.io.IOException;
 import java.time.Duration;
 import java.util.Arrays;
 import java.util.Collection;
@@ -39,19 +39,19 @@ import java.util.stream.Collectors;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.jupiter.api.Assertions.fail;
 
 /**
  * This class contains test for the configuration package. In particular, the 
serialization of
  * {@link Configuration} objects is tested.
  */
 @ExtendWith(ParameterizedTestExtension.class)
-public class ConfigurationTest {
+@SuppressWarnings("deprecation")
+class ConfigurationTest {
 
-    @Parameter public boolean standardYaml;
+    @Parameter private boolean standardYaml;
 
     @Parameters(name = "standardYaml: {0}")
-    public static Collection<Boolean> parameters() {
+    private static Collection<Boolean> parameters() {
         return Arrays.asList(true, false);
     }
 
@@ -80,55 +80,44 @@ public class ConfigurationTest {
 
     /** This test checks the serialization/deserialization of configuration 
objects. */
     @TestTemplate
-    void testConfigurationSerializationAndGetters() {
-        try {
-            final Configuration orig = new Configuration(standardYaml);
-            orig.setString("mykey", "myvalue");
-            orig.setInteger("mynumber", 100);
-            orig.setLong("longvalue", 478236947162389746L);
-            orig.setFloat("PI", 3.1415926f);
-            orig.setDouble("E", Math.E);
-            orig.setBoolean("shouldbetrue", true);
-            orig.setBytes("bytes sequence", new byte[] {1, 2, 3, 4, 5});
-            orig.setClass("myclass", this.getClass());
-
-            final Configuration copy = 
InstantiationUtil.createCopyWritable(orig);
-            assertThat("myvalue").isEqualTo(copy.getString("mykey", "null"));
-            assertThat(copy.getInteger("mynumber", 0)).isEqualTo(100);
-            
assertThat(478236947162389746L).isEqualTo(copy.getLong("longvalue", 0L));
-            assertThat(3.1415926f).isCloseTo(copy.getFloat("PI", 3.1415926f), 
Offset.offset(0.0f));
-            assertThat(Math.E).isCloseTo(copy.getDouble("E", 0.0), 
Offset.offset(0.0));
-            assertThat(copy.getBoolean("shouldbetrue", false)).isTrue();
-            assertThat(new byte[] {1, 2, 3, 4, 
5}).isEqualTo(copy.getBytes("bytes sequence", null));
-            assertThat(getClass())
-                    .isEqualTo(copy.getClass("myclass", null, 
getClass().getClassLoader()));
-
-            assertThat(orig).isEqualTo(copy);
-            assertThat(orig.keySet()).isEqualTo(copy.keySet());
-            assertThat(orig).hasSameHashCodeAs(copy);
-
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail(e.getMessage());
-        }
+    void testConfigurationSerializationAndGetters() throws 
ClassNotFoundException, IOException {
+        final Configuration orig = new Configuration(standardYaml);
+        orig.setString("mykey", "myvalue");
+        orig.setInteger("mynumber", 100);
+        orig.setLong("longvalue", 478236947162389746L);
+        orig.setFloat("PI", 3.1415926f);
+        orig.setDouble("E", Math.E);
+        orig.setBoolean("shouldbetrue", true);
+        orig.setBytes("bytes sequence", new byte[] {1, 2, 3, 4, 5});
+        orig.setClass("myclass", this.getClass());
+
+        final Configuration copy = InstantiationUtil.createCopyWritable(orig);
+        assertThat("myvalue").isEqualTo(copy.getString("mykey", "null"));
+        assertThat(copy.getInteger("mynumber", 0)).isEqualTo(100);
+        assertThat(copy.getLong("longvalue", 
0L)).isEqualTo(478236947162389746L);
+        assertThat(copy.getFloat("PI", 3.1415926f)).isCloseTo(3.1415926f, 
Offset.offset(0.0f));
+        assertThat(copy.getDouble("E", 0.0)).isCloseTo(Math.E, 
Offset.offset(0.0));
+        assertThat(copy.getBoolean("shouldbetrue", false)).isTrue();
+        assertThat(copy.getBytes("bytes sequence", null)).containsExactly(1, 
2, 3, 4, 5);
+        assertThat(getClass())
+                .isEqualTo(copy.getClass("myclass", null, 
getClass().getClassLoader()));
+
+        assertThat(copy).isEqualTo(orig);
+        assertThat(copy.keySet()).isEqualTo(orig.keySet());
+        assertThat(copy).hasSameHashCodeAs(orig);
     }
 
     @TestTemplate
     void testCopyConstructor() {
-        try {
-            final String key = "theKey";
+        final String key = "theKey";
 
-            Configuration cfg1 = new Configuration(standardYaml);
-            cfg1.setString(key, "value");
+        Configuration cfg1 = new Configuration(standardYaml);
+        cfg1.setString(key, "value");
 
-            Configuration cfg2 = new Configuration(cfg1);
-            cfg2.setString(key, "another value");
+        Configuration cfg2 = new Configuration(cfg1);
+        cfg2.setString(key, "another value");
 
-            assertThat("value").isEqualTo(cfg1.getString(key, ""));
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail(e.getMessage());
-        }
+        assertThat(cfg1.getString(key, "")).isEqualTo("value");
     }
 
     @TestTemplate
@@ -142,11 +131,11 @@ public class ConfigurationTest {
         ConfigOption<Integer> presentIntOption =
                 ConfigOptions.key("int-key").intType().defaultValue(87);
 
-        assertThat("abc").isEqualTo(cfg.getString(presentStringOption));
-        assertThat("abc").isEqualTo(cfg.getValue(presentStringOption));
+        assertThat(cfg.getString(presentStringOption)).isEqualTo("abc");
+        assertThat(cfg.getValue(presentStringOption)).isEqualTo("abc");
 
         assertThat(cfg.getInteger(presentIntOption)).isEqualTo(11);
-        assertThat("11").isEqualTo(cfg.getValue(presentIntOption));
+        assertThat(cfg.getValue(presentIntOption)).isEqualTo("11");
 
         // test getting default when no value is present
 
@@ -155,15 +144,15 @@ public class ConfigurationTest {
         ConfigOption<Integer> intOption = 
ConfigOptions.key("test2").intType().defaultValue(87);
 
         // getting strings with default value should work
-        
assertThat("my-beautiful-default").isEqualTo(cfg.getValue(stringOption));
-        
assertThat("my-beautiful-default").isEqualTo(cfg.getString(stringOption));
+        
assertThat(cfg.getValue(stringOption)).isEqualTo("my-beautiful-default");
+        
assertThat(cfg.getString(stringOption)).isEqualTo("my-beautiful-default");
 
         // overriding the default should work
-        assertThat("override").isEqualTo(cfg.getString(stringOption, 
"override"));
+        assertThat(cfg.getString(stringOption, 
"override")).isEqualTo("override");
 
         // getting a primitive with a default value should work
         assertThat(cfg.getInteger(intOption)).isEqualTo(87);
-        assertThat("87").isEqualTo(cfg.getValue(intOption));
+        assertThat(cfg.getValue(intOption)).isEqualTo("87");
     }
 
     @TestTemplate
@@ -175,8 +164,8 @@ public class ConfigurationTest {
         ConfigOption<String> presentStringOption =
                 ConfigOptions.key("string-key").stringType().noDefaultValue();
 
-        assertThat("abc").isEqualTo(cfg.getString(presentStringOption));
-        assertThat("abc").isEqualTo(cfg.getValue(presentStringOption));
+        assertThat(cfg.getString(presentStringOption)).isEqualTo("abc");
+        assertThat(cfg.getValue(presentStringOption)).isEqualTo("abc");
 
         // test getting default when no value is present
 
@@ -187,7 +176,7 @@ public class ConfigurationTest {
         assertThat(cfg.getString(stringOption)).isNull();
 
         // overriding the null default should work
-        assertThat("override").isEqualTo(cfg.getString(stringOption, 
"override"));
+        assertThat(cfg.getString(stringOption, 
"override")).isEqualTo("override");
     }
 
     @TestTemplate
@@ -372,18 +361,14 @@ public class ConfigurationTest {
         final String invalidValueForTestEnum = "InvalidValueForTestEnum";
         configuration.setString(STRING_OPTION.key(), invalidValueForTestEnum);
 
-        try {
-            configuration.getEnum(TestEnum.class, STRING_OPTION);
-            fail("Expected exception not thrown");
-        } catch (IllegalArgumentException e) {
-            final String expectedMessage =
-                    "Value for config option "
-                            + STRING_OPTION.key()
-                            + " must be one of [VALUE1, VALUE2] (was "
-                            + invalidValueForTestEnum
-                            + ")";
-            assertThat(e.getMessage()).contains(expectedMessage);
-        }
+        assertThatThrownBy(() -> configuration.getEnum(TestEnum.class, 
STRING_OPTION))
+                .isInstanceOf(IllegalArgumentException.class)
+                .hasMessageContaining(
+                        "Value for config option "
+                                + STRING_OPTION.key()
+                                + " must be one of [VALUE1, VALUE2] (was "
+                                + invalidValueForTestEnum
+                                + ")");
     }
 
     @TestTemplate
@@ -436,28 +421,28 @@ public class ConfigurationTest {
         configuration.set(STRING_OPTION, strValues);
 
         if (standardYaml) {
-            assertThat(yamlListValues)
-                    
.isEqualTo(configuration.toFileWritableMap().get(LIST_STRING_OPTION.key()));
-            assertThat(yamlMapValues)
-                    
.isEqualTo(configuration.toFileWritableMap().get(MAP_OPTION.key()));
-            assertThat(yamlStrValues)
-                    
.isEqualTo(configuration.toFileWritableMap().get(STRING_OPTION.key()));
+            
assertThat(configuration.toFileWritableMap().get(LIST_STRING_OPTION.key()))
+                    .isEqualTo(yamlListValues);
+            assertThat(configuration.toFileWritableMap().get(MAP_OPTION.key()))
+                    .isEqualTo(yamlMapValues);
+            
assertThat(configuration.toFileWritableMap().get(STRING_OPTION.key()))
+                    .isEqualTo(yamlStrValues);
         } else {
-            assertThat(listValues)
-                    
.isEqualTo(configuration.toFileWritableMap().get(LIST_STRING_OPTION.key()));
-            assertThat(mapValues)
-                    
.isEqualTo(configuration.toFileWritableMap().get(MAP_OPTION.key()));
-            assertThat(strValues)
-                    
.isEqualTo(configuration.toFileWritableMap().get(STRING_OPTION.key()));
+            
assertThat(configuration.toFileWritableMap().get(LIST_STRING_OPTION.key()))
+                    .isEqualTo(listValues);
+            assertThat(configuration.toFileWritableMap().get(MAP_OPTION.key()))
+                    .isEqualTo(mapValues);
+            
assertThat(configuration.toFileWritableMap().get(STRING_OPTION.key()))
+                    .isEqualTo(strValues);
         }
-        assertThat("3 
s").isEqualTo(configuration.toMap().get(DURATION_OPTION.key()));
+        
assertThat(configuration.toMap().get(DURATION_OPTION.key())).isEqualTo("3 s");
     }
 
     @TestTemplate
     void testMapNotContained() {
         final Configuration cfg = new Configuration(standardYaml);
 
-        assertThat(cfg.getOptional(MAP_OPTION).isPresent()).isFalse();
+        assertThat(cfg.getOptional(MAP_OPTION)).isNotPresent();
         assertThat(cfg.contains(MAP_OPTION)).isFalse();
     }
 
@@ -521,7 +506,7 @@ public class ConfigurationTest {
         ConfigOption<List<String>> secret =
                 
ConfigOptions.key("secret").stringType().asList().noDefaultValue();
 
-        
Assertions.assertThat(GlobalConfiguration.isSensitive(secret.key())).isTrue();
+        assertThat(GlobalConfiguration.isSensitive(secret.key())).isTrue();
 
         final Configuration cfg = new Configuration(standardYaml);
         // missing closing quote
@@ -531,7 +516,7 @@ public class ConfigurationTest {
                 .isInstanceOf(IllegalArgumentException.class)
                 .satisfies(
                         e ->
-                                
Assertions.assertThat(ExceptionUtils.stringifyException(e))
+                                
assertThat(ExceptionUtils.stringifyException(e))
                                         .doesNotContain("secret_value"));
     }
 
@@ -540,7 +525,7 @@ public class ConfigurationTest {
         ConfigOption<Map<String, String>> secret =
                 ConfigOptions.key("secret").mapType().noDefaultValue();
 
-        
Assertions.assertThat(GlobalConfiguration.isSensitive(secret.key())).isTrue();
+        assertThat(GlobalConfiguration.isSensitive(secret.key())).isTrue();
 
         final Configuration cfg = new Configuration(standardYaml);
         // malformed map representation
@@ -550,7 +535,7 @@ public class ConfigurationTest {
                 .isInstanceOf(IllegalArgumentException.class)
                 .satisfies(
                         e ->
-                                
Assertions.assertThat(ExceptionUtils.stringifyException(e))
+                                
assertThat(ExceptionUtils.stringifyException(e))
                                         .doesNotContain("secret_value"));
     }
 
@@ -559,7 +544,7 @@ public class ConfigurationTest {
         ConfigOption<Map<String, String>> secret =
                 ConfigOptions.key("secret").mapType().noDefaultValue();
 
-        
Assertions.assertThat(GlobalConfiguration.isSensitive(secret.key())).isTrue();
+        assertThat(GlobalConfiguration.isSensitive(secret.key())).isTrue();
 
         final Configuration cfg = new Configuration(standardYaml);
         cfg.setString(secret.key(), "secret_value");
diff --git 
a/flink-core/src/test/java/org/apache/flink/configuration/ConfigurationUtilsTest.java
 
b/flink-core/src/test/java/org/apache/flink/configuration/ConfigurationUtilsTest.java
index 757bf9e953c..547b91f9a92 100644
--- 
a/flink-core/src/test/java/org/apache/flink/configuration/ConfigurationUtilsTest.java
+++ 
b/flink-core/src/test/java/org/apache/flink/configuration/ConfigurationUtilsTest.java
@@ -45,12 +45,12 @@ import static org.assertj.core.api.Assertions.assertThat;
 
 /** Tests for the {@link ConfigurationUtils}. */
 @ExtendWith(ParameterizedTestExtension.class)
-public class ConfigurationUtilsTest {
+class ConfigurationUtilsTest {
 
-    @Parameter public boolean standardYaml;
+    @Parameter private boolean standardYaml;
 
     @Parameters(name = "standardYaml: {0}")
-    public static Collection<Boolean> parameters() {
+    private static Collection<Boolean> parameters() {
         return Arrays.asList(true, false);
     }
 
diff --git 
a/flink-core/src/test/java/org/apache/flink/configuration/CoreOptionsTest.java 
b/flink-core/src/test/java/org/apache/flink/configuration/CoreOptionsTest.java
index 9abf1d8a21e..62255c903f2 100644
--- 
a/flink-core/src/test/java/org/apache/flink/configuration/CoreOptionsTest.java
+++ 
b/flink-core/src/test/java/org/apache/flink/configuration/CoreOptionsTest.java
@@ -18,18 +18,19 @@
 
 package org.apache.flink.configuration;
 
-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 java.util.function.Function;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 /** Tests for {@link CoreOptions}. */
-public class CoreOptionsTest {
+class CoreOptionsTest {
     @Test
-    public void testGetParentFirstLoaderPatterns() {
+    void testGetParentFirstLoaderPatterns() {
         testParentFirst(
                 CoreOptions::getParentFirstLoaderPatterns,
                 CoreOptions.ALWAYS_PARENT_FIRST_LOADER_PATTERNS,
@@ -37,7 +38,7 @@ public class CoreOptionsTest {
     }
 
     @Test
-    public void testGetPluginParentFirstLoaderPatterns() {
+    void testGetPluginParentFirstLoaderPatterns() {
         testParentFirst(
                 CoreOptions::getPluginParentFirstLoaderPatterns,
                 CoreOptions.PLUGIN_ALWAYS_PARENT_FIRST_LOADER_PATTERNS,
@@ -49,20 +50,20 @@ public class CoreOptionsTest {
             ConfigOption<List<String>> patternOption,
             ConfigOption<List<String>> additionalOption) {
         Configuration config = new Configuration();
-        Assert.assertArrayEquals(
-                patternOption.defaultValue().toArray(new String[0]), 
patternGetter.apply(config));
+        assertThat(patternGetter.apply(config))
+                .containsExactly(patternOption.defaultValue().toArray(new 
String[0]));
 
         config.set(patternOption, Arrays.asList("hello", "world"));
 
-        Assert.assertArrayEquals(new String[] {"hello", "world"}, 
patternGetter.apply(config));
+        assertThat(patternGetter.apply(config)).containsExactly("hello", 
"world");
 
         config.set(additionalOption, Arrays.asList("how", "are", "you"));
 
-        Assert.assertArrayEquals(
-                new String[] {"hello", "world", "how", "are", "you"}, 
patternGetter.apply(config));
+        assertThat(patternGetter.apply(config))
+                .containsExactly("hello", "world", "how", "are", "you");
 
         config.set(patternOption, Collections.emptyList());
 
-        Assert.assertArrayEquals(new String[] {"how", "are", "you"}, 
patternGetter.apply(config));
+        assertThat(patternGetter.apply(config)).containsExactly("how", "are", 
"you");
     }
 }
diff --git 
a/flink-core/src/test/java/org/apache/flink/configuration/FilesystemSchemeConfigTest.java
 
b/flink-core/src/test/java/org/apache/flink/configuration/FilesystemSchemeConfigTest.java
index 48f933ab24a..25d7beaf7af 100644
--- 
a/flink-core/src/test/java/org/apache/flink/configuration/FilesystemSchemeConfigTest.java
+++ 
b/flink-core/src/test/java/org/apache/flink/configuration/FilesystemSchemeConfigTest.java
@@ -21,83 +21,75 @@ package org.apache.flink.configuration;
 import org.apache.flink.core.fs.FileSystem;
 import org.apache.flink.core.fs.UnsupportedFileSystemSchemeException;
 import org.apache.flink.core.fs.local.LocalFileSystem;
-import org.apache.flink.util.TestLogger;
 
-import org.junit.After;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
 
-import java.io.IOException;
+import java.io.File;
 import java.net.URI;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-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 configuration of the default file system scheme. */
-public class FilesystemSchemeConfigTest extends TestLogger {
+class FilesystemSchemeConfigTest {
 
-    @Rule public final TemporaryFolder tempFolder = new TemporaryFolder();
+    @TempDir private File tempFolder;
 
-    @After
-    public void clearFsSettings() throws IOException {
+    @AfterEach
+    void clearFsSettings() {
         FileSystem.initialize(new Configuration());
     }
 
     // ------------------------------------------------------------------------
 
     @Test
-    public void testDefaultsToLocal() throws Exception {
-        URI justPath = new URI(tempFolder.newFile().toURI().getPath());
-        assertNull(justPath.getScheme());
+    void testDefaultsToLocal() throws Exception {
+        URI justPath = new URI(File.createTempFile("junit", null, 
tempFolder).toURI().getPath());
+        assertThat(justPath.getScheme()).isNull();
 
         FileSystem fs = FileSystem.get(justPath);
-        assertEquals("file", fs.getUri().getScheme());
+        assertThat(fs.getUri().getScheme()).isEqualTo("file");
     }
 
     @Test
-    public void testExplicitlySetToLocal() throws Exception {
+    void testExplicitlySetToLocal() throws Exception {
         final Configuration conf = new Configuration();
         conf.set(CoreOptions.DEFAULT_FILESYSTEM_SCHEME, 
LocalFileSystem.getLocalFsURI().toString());
         FileSystem.initialize(conf);
 
-        URI justPath = new URI(tempFolder.newFile().toURI().getPath());
-        assertNull(justPath.getScheme());
+        URI justPath = new URI(File.createTempFile("junit", null, 
tempFolder).toURI().getPath());
+        assertThat(justPath.getScheme()).isNull();
 
         FileSystem fs = FileSystem.get(justPath);
-        assertEquals("file", fs.getUri().getScheme());
+        assertThat(fs.getUri().getScheme()).isEqualTo("file");
     }
 
     @Test
-    public void testExplicitlySetToOther() throws Exception {
+    void testExplicitlySetToOther() throws Exception {
         final Configuration conf = new Configuration();
         conf.set(CoreOptions.DEFAULT_FILESYSTEM_SCHEME, 
"otherFS://localhost:1234/");
         FileSystem.initialize(conf);
 
-        URI justPath = new URI(tempFolder.newFile().toURI().getPath());
-        assertNull(justPath.getScheme());
+        URI justPath = new URI(File.createTempFile("junit", null, 
tempFolder).toURI().getPath());
+        assertThat(justPath.getScheme()).isNull();
 
-        try {
-            FileSystem.get(justPath);
-            fail("should have failed with an exception");
-        } catch (UnsupportedFileSystemSchemeException e) {
-            assertTrue(e.getMessage().contains("otherFS"));
-        }
+        assertThatThrownBy(() -> FileSystem.get(justPath))
+                .isInstanceOf(UnsupportedFileSystemSchemeException.class)
+                .hasMessageContaining("otherFS");
     }
 
     @Test
-    public void testExplicitlyPathTakesPrecedence() throws Exception {
+    void testExplicitlyPathTakesPrecedence() throws Exception {
         final Configuration conf = new Configuration();
         conf.set(CoreOptions.DEFAULT_FILESYSTEM_SCHEME, 
"otherFS://localhost:1234/");
         FileSystem.initialize(conf);
 
-        URI pathAndScheme = tempFolder.newFile().toURI();
-        assertNotNull(pathAndScheme.getScheme());
+        URI pathAndScheme = File.createTempFile("junit", null, 
tempFolder).toURI();
+        assertThat(pathAndScheme.getScheme()).isNotNull();
 
         FileSystem fs = FileSystem.get(pathAndScheme);
-        assertEquals("file", fs.getUri().getScheme());
+        assertThat(fs.getUri().getScheme()).isEqualTo("file");
     }
 }
diff --git 
a/flink-core/src/test/java/org/apache/flink/configuration/GlobalConfigurationTest.java
 
b/flink-core/src/test/java/org/apache/flink/configuration/GlobalConfigurationTest.java
index f1e0d1a2358..603527ad8f7 100644
--- 
a/flink-core/src/test/java/org/apache/flink/configuration/GlobalConfigurationTest.java
+++ 
b/flink-core/src/test/java/org/apache/flink/configuration/GlobalConfigurationTest.java
@@ -42,61 +42,50 @@ class GlobalConfigurationTest {
     @TempDir private File tmpDir;
 
     @Test
-    void testConfigurationWithLegacyYAML() {
+    void testConfigurationWithLegacyYAML() throws FileNotFoundException {
         File confFile = new File(tmpDir, 
GlobalConfiguration.LEGACY_FLINK_CONF_FILENAME);
-
-        try {
-            try (final PrintWriter pw = new PrintWriter(confFile)) {
-
-                pw.println("###########################"); // should be skipped
-                pw.println("# Some : comments : to skip"); // should be skipped
-                pw.println("###########################"); // should be skipped
-                pw.println("mykey1: myvalue1"); // OK, simple correct case
-                pw.println("mykey2       : myvalue2"); // OK, whitespace 
before colon is correct
-                pw.println("mykey3:myvalue3"); // SKIP, missing white space 
after colon
-                pw.println(" some nonsense without colon and whitespace 
separator"); // SKIP
-                pw.println(" :  "); // SKIP
-                pw.println("   "); // SKIP (silently)
-                pw.println(" "); // SKIP (silently)
-                pw.println("mykey4: myvalue4# some comments"); // OK, skip 
comments only
-                pw.println("   mykey5    :    myvalue5    "); // OK, trim 
unnecessary whitespace
-                pw.println("mykey6: my: value6"); // OK, only use first ': ' 
as separator
-                pw.println("mykey7: "); // SKIP, no value provided
-                pw.println(": myvalue8"); // SKIP, no key provided
-
-                pw.println("mykey9: myvalue9"); // OK
-                pw.println("mykey9: myvalue10"); // OK, overwrite last value
-
-            } catch (FileNotFoundException e) {
-                e.printStackTrace();
-            }
-
-            Configuration conf = 
GlobalConfiguration.loadConfiguration(tmpDir.getAbsolutePath());
-
-            // all distinct keys from confFile1 + confFile2 key
-            assertThat(conf.keySet()).hasSize(6);
-
-            // keys 1, 2, 4, 5, 6, 7, 8 should be OK and match the expected 
values
-            assertThat(conf.getString("mykey1", null)).isEqualTo("myvalue1");
-            assertThat(conf.getString("mykey1", null)).isEqualTo("myvalue1");
-            assertThat(conf.getString("mykey2", null)).isEqualTo("myvalue2");
-            assertThat(conf.getString("mykey3", "null")).isEqualTo("null");
-            assertThat(conf.getString("mykey4", null)).isEqualTo("myvalue4");
-            assertThat(conf.getString("mykey5", null)).isEqualTo("myvalue5");
-            assertThat(conf.getString("mykey6", null)).isEqualTo("my: value6");
-            assertThat(conf.getString("mykey7", "null")).isEqualTo("null");
-            assertThat(conf.getString("mykey8", "null")).isEqualTo("null");
-            assertThat(conf.getString("mykey9", null)).isEqualTo("myvalue10");
-        } finally {
-            // Clear the standard yaml flag to avoid impact to other cases.
-            GlobalConfiguration.setStandardYaml(true);
-            confFile.delete();
-            tmpDir.delete();
+        try (PrintWriter pw = new PrintWriter(confFile)) {
+            pw.println("###########################"); // should be skipped
+            pw.println("# Some : comments : to skip"); // should be skipped
+            pw.println("###########################"); // should be skipped
+            pw.println("mykey1: myvalue1"); // OK, simple correct case
+            pw.println("mykey2       : myvalue2"); // OK, whitespace before 
colon is correct
+            pw.println("mykey3:myvalue3"); // SKIP, missing white space after 
colon
+            pw.println(" some nonsense without colon and whitespace 
separator"); // SKIP
+            pw.println(" :  "); // SKIP
+            pw.println("   "); // SKIP (silently)
+            pw.println(" "); // SKIP (silently)
+            pw.println("mykey4: myvalue4# some comments"); // OK, skip 
comments only
+            pw.println("   mykey5    :    myvalue5    "); // OK, trim 
unnecessary whitespace
+            pw.println("mykey6: my: value6"); // OK, only use first ': ' as 
separator
+            pw.println("mykey7: "); // SKIP, no value provided
+            pw.println(": myvalue8"); // SKIP, no key provided
+
+            pw.println("mykey9: myvalue9"); // OK
+            pw.println("mykey9: myvalue10"); // OK, overwrite last value
         }
+        Configuration conf = 
GlobalConfiguration.loadConfiguration(tmpDir.getAbsolutePath());
+
+        // all distinct keys from confFile1 + confFile2 key
+        assertThat(conf.keySet()).hasSize(6);
+
+        // keys 1, 2, 4, 5, 6, 7, 8 should be OK and match the expected values
+        assertThat(conf.getString("mykey1", null)).isEqualTo("myvalue1");
+        assertThat(conf.getString("mykey1", null)).isEqualTo("myvalue1");
+        assertThat(conf.getString("mykey2", null)).isEqualTo("myvalue2");
+        assertThat(conf.getString("mykey3", "null")).isEqualTo("null");
+        assertThat(conf.getString("mykey4", null)).isEqualTo("myvalue4");
+        assertThat(conf.getString("mykey5", null)).isEqualTo("myvalue5");
+        assertThat(conf.getString("mykey6", null)).isEqualTo("my: value6");
+        assertThat(conf.getString("mykey7", "null")).isEqualTo("null");
+        assertThat(conf.getString("mykey8", "null")).isEqualTo("null");
+        assertThat(conf.getString("mykey9", null)).isEqualTo("myvalue10");
+        // Clear the standard yaml flag to avoid impact to other cases.
+        GlobalConfiguration.setStandardYaml(true);
     }
 
     @Test
-    void testConfigurationWithStandardYAML() {
+    void testConfigurationWithStandardYAML() throws FileNotFoundException {
         File confFile = new File(tmpDir, 
GlobalConfiguration.FLINK_CONF_FILENAME);
 
         try (final PrintWriter pw = new PrintWriter(confFile)) {
@@ -111,8 +100,6 @@ class GlobalConfigurationTest {
             pw.println("Key9: [a, b, '*', 1, '2',  true, 'true']");
             pw.println("Key10: {k1: v1, k2: '2', k3: 3}");
             pw.println("Key11: [{k1: v1, k2: '2', k3: 3}, {k4: true}]");
-        } catch (FileNotFoundException e) {
-            e.printStackTrace();
         }
 
         Configuration conf = 
GlobalConfiguration.loadConfiguration(tmpDir.getAbsolutePath());
@@ -205,7 +192,7 @@ class GlobalConfigurationTest {
     }
 
     @Test
-    public void testHiddenKey() {
+    void testHiddenKey() {
         assertThat(GlobalConfiguration.isSensitive("password123")).isTrue();
         assertThat(GlobalConfiguration.isSensitive("123pasSword")).isTrue();
         assertThat(GlobalConfiguration.isSensitive("PasSword")).isTrue();
diff --git 
a/flink-core/src/test/java/org/apache/flink/configuration/MemorySizePrettyPrintingTest.java
 
b/flink-core/src/test/java/org/apache/flink/configuration/MemorySizePrettyPrintingTest.java
index e5f47ed2ce0..597ee12ee07 100644
--- 
a/flink-core/src/test/java/org/apache/flink/configuration/MemorySizePrettyPrintingTest.java
+++ 
b/flink-core/src/test/java/org/apache/flink/configuration/MemorySizePrettyPrintingTest.java
@@ -19,20 +19,21 @@
 package org.apache.flink.configuration;
 
 import org.apache.flink.configuration.MemorySize.MemoryUnit;
-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 static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /** Tests for {@link MemorySize#toString()}. */
-@RunWith(Parameterized.class)
-public class MemorySizePrettyPrintingTest extends TestLogger {
-    @Parameterized.Parameters
-    public static Object[][] parameters() {
+@ExtendWith(ParameterizedTestExtension.class)
+class MemorySizePrettyPrintingTest {
+
+    @Parameters(name = "memorySize = {0}, expectedString = {1}")
+    private static Object[][] parameters() {
         return new Object[][] {
             new Object[] {new MemorySize(MemoryUnit.KILO_BYTES.getMultiplier() 
+ 1), "1025 bytes"},
             new Object[] {new MemorySize(100), "100 bytes"},
@@ -45,13 +46,13 @@ public class MemorySizePrettyPrintingTest extends 
TestLogger {
         };
     }
 
-    @Parameterized.Parameter public MemorySize memorySize;
+    @Parameter private MemorySize memorySize;
 
-    @Parameterized.Parameter(1)
-    public String expectedString;
+    @Parameter(value = 1)
+    private String expectedString;
 
-    @Test
-    public void testFormatting() {
-        assertThat(memorySize.toString(), is(expectedString));
+    @TestTemplate
+    void testFormatting() {
+        assertThat(memorySize.toString()).isEqualTo(expectedString);
     }
 }
diff --git 
a/flink-core/src/test/java/org/apache/flink/configuration/MemorySizeTest.java 
b/flink-core/src/test/java/org/apache/flink/configuration/MemorySizeTest.java
index 3b4a53e5f9d..6e3703facac 100644
--- 
a/flink-core/src/test/java/org/apache/flink/configuration/MemorySizeTest.java
+++ 
b/flink-core/src/test/java/org/apache/flink/configuration/MemorySizeTest.java
@@ -20,243 +20,223 @@ package org.apache.flink.configuration;
 
 import org.apache.flink.core.testutils.CommonTestUtils;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import java.io.IOException;
 
 import static org.apache.flink.configuration.MemorySize.MemoryUnit.MEGA_BYTES;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-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.Assertions.assertThatThrownBy;
+import static 
org.assertj.core.api.AssertionsForClassTypes.assertThatExceptionOfType;
 
 /** Tests for the {@link MemorySize} class. */
-public class MemorySizeTest {
+class MemorySizeTest {
 
     @Test
-    public void testUnitConversion() {
+    void testUnitConversion() {
         final MemorySize zero = MemorySize.ZERO;
-        assertEquals(0, zero.getBytes());
-        assertEquals(0, zero.getKibiBytes());
-        assertEquals(0, zero.getMebiBytes());
-        assertEquals(0, zero.getGibiBytes());
-        assertEquals(0, zero.getTebiBytes());
+        assertThat(zero.getBytes()).isZero();
+        assertThat(zero.getKibiBytes()).isZero();
+        assertThat(zero.getMebiBytes()).isZero();
+        assertThat(zero.getGibiBytes()).isZero();
+        assertThat(zero.getTebiBytes()).isZero();
 
         final MemorySize bytes = new MemorySize(955);
-        assertEquals(955, bytes.getBytes());
-        assertEquals(0, bytes.getKibiBytes());
-        assertEquals(0, bytes.getMebiBytes());
-        assertEquals(0, bytes.getGibiBytes());
-        assertEquals(0, bytes.getTebiBytes());
+        assertThat(bytes.getBytes()).isEqualTo(955);
+        assertThat(bytes.getKibiBytes()).isZero();
+        assertThat(bytes.getMebiBytes()).isZero();
+        assertThat(bytes.getGibiBytes()).isZero();
+        assertThat(bytes.getTebiBytes()).isZero();
 
         final MemorySize kilos = new MemorySize(18500);
-        assertEquals(18500, kilos.getBytes());
-        assertEquals(18, kilos.getKibiBytes());
-        assertEquals(0, kilos.getMebiBytes());
-        assertEquals(0, kilos.getGibiBytes());
-        assertEquals(0, kilos.getTebiBytes());
+        assertThat(kilos.getBytes()).isEqualTo(18500);
+        assertThat(kilos.getKibiBytes()).isEqualTo(18);
+        assertThat(kilos.getMebiBytes()).isZero();
+        assertThat(kilos.getGibiBytes()).isZero();
+        assertThat(kilos.getTebiBytes()).isZero();
 
         final MemorySize megas = new MemorySize(15 * 1024 * 1024);
-        assertEquals(15_728_640, megas.getBytes());
-        assertEquals(15_360, megas.getKibiBytes());
-        assertEquals(15, megas.getMebiBytes());
-        assertEquals(0, megas.getGibiBytes());
-        assertEquals(0, megas.getTebiBytes());
+        assertThat(megas.getBytes()).isEqualTo(15_728_640);
+        assertThat(megas.getKibiBytes()).isEqualTo(15_360);
+        assertThat(megas.getMebiBytes()).isEqualTo(15);
+        assertThat(megas.getGibiBytes()).isZero();
+        assertThat(megas.getTebiBytes()).isZero();
 
         final MemorySize teras = new MemorySize(2L * 1024 * 1024 * 1024 * 1024 
+ 10);
-        assertEquals(2199023255562L, teras.getBytes());
-        assertEquals(2147483648L, teras.getKibiBytes());
-        assertEquals(2097152, teras.getMebiBytes());
-        assertEquals(2048, teras.getGibiBytes());
-        assertEquals(2, teras.getTebiBytes());
+        assertThat(teras.getBytes()).isEqualTo(2199023255562L);
+        assertThat(teras.getKibiBytes()).isEqualTo(2147483648L);
+        assertThat(teras.getMebiBytes()).isEqualTo(2097152);
+        assertThat(teras.getGibiBytes()).isEqualTo(2048);
+        assertThat(teras.getTebiBytes()).isEqualTo(2);
     }
 
-    @Test(expected = IllegalArgumentException.class)
-    public void testInvalid() {
-        new MemorySize(-1);
+    @Test
+    void testInvalid() {
+        assertThatExceptionOfType(IllegalArgumentException.class)
+                .isThrownBy(() -> new MemorySize(-1));
     }
 
     @Test
-    public void testStandardUtils() throws IOException {
+    void testStandardUtils() throws IOException {
         final MemorySize size = new MemorySize(1234567890L);
         final MemorySize cloned = CommonTestUtils.createCopySerializable(size);
 
-        assertEquals(size, cloned);
-        assertEquals(size.hashCode(), cloned.hashCode());
-        assertEquals(size.toString(), cloned.toString());
+        assertThat(cloned).isEqualTo(size);
+        assertThat(cloned.hashCode()).isEqualTo(size.hashCode());
+        assertThat(cloned.toString()).isEqualTo(size.toString());
     }
 
     @Test
-    public void testParseBytes() {
-        assertEquals(1234, MemorySize.parseBytes("1234"));
-        assertEquals(1234, MemorySize.parseBytes("1234b"));
-        assertEquals(1234, MemorySize.parseBytes("1234 b"));
-        assertEquals(1234, MemorySize.parseBytes("1234bytes"));
-        assertEquals(1234, MemorySize.parseBytes("1234 bytes"));
+    void testParseBytes() {
+        assertThat(MemorySize.parseBytes("1234")).isEqualTo(1234);
+        assertThat(MemorySize.parseBytes("1234b")).isEqualTo(1234);
+        assertThat(MemorySize.parseBytes("1234 b")).isEqualTo(1234);
+        assertThat(MemorySize.parseBytes("1234bytes")).isEqualTo(1234);
+        assertThat(MemorySize.parseBytes("1234 bytes")).isEqualTo(1234);
     }
 
     @Test
-    public void testParseKibiBytes() {
-        assertEquals(667766, MemorySize.parse("667766k").getKibiBytes());
-        assertEquals(667766, MemorySize.parse("667766 k").getKibiBytes());
-        assertEquals(667766, MemorySize.parse("667766kb").getKibiBytes());
-        assertEquals(667766, MemorySize.parse("667766 kb").getKibiBytes());
-        assertEquals(667766, 
MemorySize.parse("667766kibibytes").getKibiBytes());
-        assertEquals(667766, MemorySize.parse("667766 
kibibytes").getKibiBytes());
+    void testParseKibiBytes() {
+        
assertThat(MemorySize.parse("667766k").getKibiBytes()).isEqualTo(667766);
+        assertThat(MemorySize.parse("667766 
k").getKibiBytes()).isEqualTo(667766);
+        
assertThat(MemorySize.parse("667766kb").getKibiBytes()).isEqualTo(667766);
+        assertThat(MemorySize.parse("667766 
kb").getKibiBytes()).isEqualTo(667766);
+        
assertThat(MemorySize.parse("667766kibibytes").getKibiBytes()).isEqualTo(667766);
+        assertThat(MemorySize.parse("667766 
kibibytes").getKibiBytes()).isEqualTo(667766);
     }
 
     @Test
-    public void testParseMebiBytes() {
-        assertEquals(7657623, MemorySize.parse("7657623m").getMebiBytes());
-        assertEquals(7657623, MemorySize.parse("7657623 m").getMebiBytes());
-        assertEquals(7657623, MemorySize.parse("7657623mb").getMebiBytes());
-        assertEquals(7657623, MemorySize.parse("7657623 mb").getMebiBytes());
-        assertEquals(7657623, 
MemorySize.parse("7657623mebibytes").getMebiBytes());
-        assertEquals(7657623, MemorySize.parse("7657623 
mebibytes").getMebiBytes());
+    void testParseMebiBytes() {
+        
assertThat(MemorySize.parse("7657623m").getMebiBytes()).isEqualTo(7657623);
+        assertThat(MemorySize.parse("7657623 
m").getMebiBytes()).isEqualTo(7657623);
+        
assertThat(MemorySize.parse("7657623mb").getMebiBytes()).isEqualTo(7657623);
+        assertThat(MemorySize.parse("7657623 
mb").getMebiBytes()).isEqualTo(7657623);
+        
assertThat(MemorySize.parse("7657623mebibytes").getMebiBytes()).isEqualTo(7657623);
+        assertThat(MemorySize.parse("7657623 
mebibytes").getMebiBytes()).isEqualTo(7657623);
     }
 
     @Test
-    public void testParseGibiBytes() {
-        assertEquals(987654, MemorySize.parse("987654g").getGibiBytes());
-        assertEquals(987654, MemorySize.parse("987654 g").getGibiBytes());
-        assertEquals(987654, MemorySize.parse("987654gb").getGibiBytes());
-        assertEquals(987654, MemorySize.parse("987654 gb").getGibiBytes());
-        assertEquals(987654, 
MemorySize.parse("987654gibibytes").getGibiBytes());
-        assertEquals(987654, MemorySize.parse("987654 
gibibytes").getGibiBytes());
+    void testParseGibiBytes() {
+        
assertThat(MemorySize.parse("987654g").getGibiBytes()).isEqualTo(987654);
+        assertThat(MemorySize.parse("987654 
g").getGibiBytes()).isEqualTo(987654);
+        
assertThat(MemorySize.parse("987654gb").getGibiBytes()).isEqualTo(987654);
+        assertThat(MemorySize.parse("987654 
gb").getGibiBytes()).isEqualTo(987654);
+        
assertThat(MemorySize.parse("987654gibibytes").getGibiBytes()).isEqualTo(987654);
+        assertThat(MemorySize.parse("987654 
gibibytes").getGibiBytes()).isEqualTo(987654);
     }
 
     @Test
-    public void testParseTebiBytes() {
-        assertEquals(1234567, MemorySize.parse("1234567t").getTebiBytes());
-        assertEquals(1234567, MemorySize.parse("1234567 t").getTebiBytes());
-        assertEquals(1234567, MemorySize.parse("1234567tb").getTebiBytes());
-        assertEquals(1234567, MemorySize.parse("1234567 tb").getTebiBytes());
-        assertEquals(1234567, 
MemorySize.parse("1234567tebibytes").getTebiBytes());
-        assertEquals(1234567, MemorySize.parse("1234567 
tebibytes").getTebiBytes());
+    void testParseTebiBytes() {
+        
assertThat(MemorySize.parse("1234567t").getTebiBytes()).isEqualTo(1234567);
+        assertThat(MemorySize.parse("1234567 
t").getTebiBytes()).isEqualTo(1234567);
+        
assertThat(MemorySize.parse("1234567tb").getTebiBytes()).isEqualTo(1234567);
+        assertThat(MemorySize.parse("1234567 
tb").getTebiBytes()).isEqualTo(1234567);
+        
assertThat(MemorySize.parse("1234567tebibytes").getTebiBytes()).isEqualTo(1234567);
+        assertThat(MemorySize.parse("1234567 
tebibytes").getTebiBytes()).isEqualTo(1234567);
     }
 
     @Test
-    public void testUpperCase() {
-        assertEquals(1L, MemorySize.parse("1 B").getBytes());
-        assertEquals(1L, MemorySize.parse("1 K").getKibiBytes());
-        assertEquals(1L, MemorySize.parse("1 M").getMebiBytes());
-        assertEquals(1L, MemorySize.parse("1 G").getGibiBytes());
-        assertEquals(1L, MemorySize.parse("1 T").getTebiBytes());
+    void testUpperCase() {
+        assertThat(MemorySize.parse("1 B").getBytes()).isOne();
+        assertThat(MemorySize.parse("1 K").getKibiBytes()).isOne();
+        assertThat(MemorySize.parse("1 M").getMebiBytes()).isOne();
+        assertThat(MemorySize.parse("1 G").getGibiBytes()).isOne();
+        assertThat(MemorySize.parse("1 T").getTebiBytes()).isOne();
     }
 
     @Test
-    public void testTrimBeforeParse() {
-        assertEquals(155L, MemorySize.parseBytes("      155      "));
-        assertEquals(155L, MemorySize.parseBytes("      155      bytes   "));
+    void testTrimBeforeParse() {
+        assertThat(MemorySize.parseBytes("      155      ")).isEqualTo(155L);
+        assertThat(MemorySize.parseBytes("      155      bytes   
")).isEqualTo(155L);
     }
 
     @Test
-    public void testParseInvalid() {
+    void testParseInvalid() {
         // null
-        try {
-            MemorySize.parseBytes(null);
-            fail("exception expected");
-        } catch (NullPointerException ignored) {
-        }
+        assertThatThrownBy(() -> MemorySize.parseBytes(null))
+                .isInstanceOf(NullPointerException.class);
 
         // empty
-        try {
-            MemorySize.parseBytes("");
-            fail("exception expected");
-        } catch (IllegalArgumentException ignored) {
-        }
+        assertThatThrownBy(() -> MemorySize.parseBytes(""))
+                .isInstanceOf(IllegalArgumentException.class);
 
         // blank
-        try {
-            MemorySize.parseBytes("     ");
-            fail("exception expected");
-        } catch (IllegalArgumentException ignored) {
-        }
+        assertThatThrownBy(() -> MemorySize.parseBytes("     "))
+                .isInstanceOf(IllegalArgumentException.class);
 
         // no number
-        try {
-            MemorySize.parseBytes("foobar or fubar or foo bazz");
-            fail("exception expected");
-        } catch (IllegalArgumentException ignored) {
-        }
+        assertThatThrownBy(() -> MemorySize.parseBytes("foobar or fubar or foo 
bazz"))
+                .isInstanceOf(IllegalArgumentException.class);
 
         // wrong unit
-        try {
-            MemorySize.parseBytes("16 gjah");
-            fail("exception expected");
-        } catch (IllegalArgumentException ignored) {
-        }
+        assertThatThrownBy(() -> MemorySize.parseBytes("16 gjah"))
+                .isInstanceOf(IllegalArgumentException.class);
 
         // multiple numbers
-        try {
-            MemorySize.parseBytes("16 16 17 18 bytes");
-            fail("exception expected");
-        } catch (IllegalArgumentException ignored) {
-        }
+        assertThatThrownBy(() -> MemorySize.parseBytes("16 16 17 18 bytes"))
+                .isInstanceOf(IllegalArgumentException.class);
 
         // negative number
-        try {
-            MemorySize.parseBytes("-100 bytes");
-            fail("exception expected");
-        } catch (IllegalArgumentException ignored) {
-        }
+        assertThatThrownBy(() -> MemorySize.parseBytes("-100 bytes"))
+                .isInstanceOf(IllegalArgumentException.class);
     }
 
-    @Test(expected = IllegalArgumentException.class)
-    public void testParseNumberOverflow() {
-        MemorySize.parseBytes("100000000000000000000000000000000 bytes");
+    @Test
+    void testParseNumberOverflow() {
+        assertThatExceptionOfType(IllegalArgumentException.class)
+                .isThrownBy(() -> 
MemorySize.parseBytes("100000000000000000000000000000000 bytes"));
     }
 
-    @Test(expected = IllegalArgumentException.class)
-    public void testParseNumberTimeUnitOverflow() {
-        MemorySize.parseBytes("100000000000000 tb");
+    @Test
+    void testParseNumberTimeUnitOverflow() {
+        assertThatExceptionOfType(IllegalArgumentException.class)
+                .isThrownBy(() -> MemorySize.parseBytes("100000000000000 tb"));
     }
 
     @Test
-    public void testParseWithDefaultUnit() {
-        assertEquals(7, MemorySize.parse("7", MEGA_BYTES).getMebiBytes());
-        assertNotEquals(7, MemorySize.parse("7340032", MEGA_BYTES));
-        assertEquals(7, MemorySize.parse("7m", MEGA_BYTES).getMebiBytes());
-        assertEquals(7168, MemorySize.parse("7", MEGA_BYTES).getKibiBytes());
-        assertEquals(7168, MemorySize.parse("7m", MEGA_BYTES).getKibiBytes());
-        assertEquals(7, MemorySize.parse("7 m", MEGA_BYTES).getMebiBytes());
-        assertEquals(7, MemorySize.parse("7mb", MEGA_BYTES).getMebiBytes());
-        assertEquals(7, MemorySize.parse("7 mb", MEGA_BYTES).getMebiBytes());
-        assertEquals(7, MemorySize.parse("7mebibytes", 
MEGA_BYTES).getMebiBytes());
-        assertEquals(7, MemorySize.parse("7 mebibytes", 
MEGA_BYTES).getMebiBytes());
+    void testParseWithDefaultUnit() {
+        assertThat(MemorySize.parse("7", 
MEGA_BYTES).getMebiBytes()).isEqualTo(7);
+        assertThat(MemorySize.parse("7340032", MEGA_BYTES)).isNotEqualTo(7);
+        assertThat(MemorySize.parse("7m", 
MEGA_BYTES).getMebiBytes()).isEqualTo(7);
+        assertThat(MemorySize.parse("7", 
MEGA_BYTES).getKibiBytes()).isEqualTo(7168);
+        assertThat(MemorySize.parse("7m", 
MEGA_BYTES).getKibiBytes()).isEqualTo(7168);
+        assertThat(MemorySize.parse("7 m", 
MEGA_BYTES).getMebiBytes()).isEqualTo(7);
+        assertThat(MemorySize.parse("7mb", 
MEGA_BYTES).getMebiBytes()).isEqualTo(7);
+        assertThat(MemorySize.parse("7 mb", 
MEGA_BYTES).getMebiBytes()).isEqualTo(7);
+        assertThat(MemorySize.parse("7mebibytes", 
MEGA_BYTES).getMebiBytes()).isEqualTo(7);
+        assertThat(MemorySize.parse("7 mebibytes", 
MEGA_BYTES).getMebiBytes()).isEqualTo(7);
     }
 
     @Test
-    public void testDivideByLong() {
+    void testDivideByLong() {
         final MemorySize memory = new MemorySize(100L);
-        assertThat(memory.divide(23), is(new MemorySize(4L)));
+        assertThat(memory.divide(23)).isEqualTo(new MemorySize(4L));
     }
 
-    @Test(expected = IllegalArgumentException.class)
-    public void testDivideByNegativeLong() {
-        final MemorySize memory = new MemorySize(100L);
-        memory.divide(-23L);
+    @Test
+    void testDivideByNegativeLong() {
+        assertThatExceptionOfType(IllegalArgumentException.class)
+                .isThrownBy(
+                        () -> {
+                            final MemorySize memory = new MemorySize(100L);
+                            memory.divide(-23L);
+                        });
     }
 
     @Test
-    public void testToHumanReadableString() {
-        assertThat(new MemorySize(0L).toHumanReadableString(), is("0 bytes"));
-        assertThat(new MemorySize(1L).toHumanReadableString(), is("1 bytes"));
-        assertThat(new MemorySize(1024L).toHumanReadableString(), is("1024 
bytes"));
-        assertThat(new MemorySize(1025L).toHumanReadableString(), is("1.001kb 
(1025 bytes)"));
-        assertThat(new MemorySize(1536L).toHumanReadableString(), is("1.500kb 
(1536 bytes)"));
-        assertThat(
-                new MemorySize(1_000_000L).toHumanReadableString(),
-                is("976.563kb (1000000 bytes)"));
-        assertThat(
-                new MemorySize(1_000_000_000L).toHumanReadableString(),
-                is("953.674mb (1000000000 bytes)"));
-        assertThat(
-                new MemorySize(1_000_000_000_000L).toHumanReadableString(),
-                is("931.323gb (1000000000000 bytes)"));
-        assertThat(
-                new MemorySize(1_000_000_000_000_000L).toHumanReadableString(),
-                is("909.495tb (1000000000000000 bytes)"));
+    void testToHumanReadableString() {
+        assertThat(new MemorySize(0L).toHumanReadableString()).isEqualTo("0 
bytes");
+        assertThat(new MemorySize(1L).toHumanReadableString()).isEqualTo("1 
bytes");
+        assertThat(new 
MemorySize(1024L).toHumanReadableString()).isEqualTo("1024 bytes");
+        assertThat(new 
MemorySize(1025L).toHumanReadableString()).isEqualTo("1.001kb (1025 bytes)");
+        assertThat(new 
MemorySize(1536L).toHumanReadableString()).isEqualTo("1.500kb (1536 bytes)");
+        assertThat(new MemorySize(1_000_000L).toHumanReadableString())
+                .isEqualTo("976.563kb (1000000 bytes)");
+        assertThat(new MemorySize(1_000_000_000L).toHumanReadableString())
+                .isEqualTo("953.674mb (1000000000 bytes)");
+        assertThat(new MemorySize(1_000_000_000_000L).toHumanReadableString())
+                .isEqualTo("931.323gb (1000000000000 bytes)");
+        assertThat(new 
MemorySize(1_000_000_000_000_000L).toHumanReadableString())
+                .isEqualTo("909.495tb (1000000000000000 bytes)");
     }
 }
diff --git 
a/flink-core/src/test/java/org/apache/flink/configuration/ParentFirstPatternsTest.java
 
b/flink-core/src/test/java/org/apache/flink/configuration/ParentFirstPatternsTest.java
index c21b349ae53..5e9781fa89e 100644
--- 
a/flink-core/src/test/java/org/apache/flink/configuration/ParentFirstPatternsTest.java
+++ 
b/flink-core/src/test/java/org/apache/flink/configuration/ParentFirstPatternsTest.java
@@ -18,29 +18,27 @@
 
 package org.apache.flink.configuration;
 
-import org.apache.flink.util.TestLogger;
-
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import java.util.HashSet;
 
-import static org.junit.Assert.assertTrue;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /**
  * Test that checks that all packages that need to be loaded 'parent-first' 
are also in the
  * parent-first patterns.
  */
-public class ParentFirstPatternsTest extends TestLogger {
+class ParentFirstPatternsTest {
 
     private static final HashSet<String> PARENT_FIRST_PACKAGES =
             new 
HashSet<>(CoreOptions.ALWAYS_PARENT_FIRST_LOADER_PATTERNS.defaultValue());
 
     /** All java and Flink classes must be loaded parent first. */
     @Test
-    public void testAllCorePatterns() {
-        assertTrue(PARENT_FIRST_PACKAGES.contains("java."));
-        assertTrue(PARENT_FIRST_PACKAGES.contains("org.apache.flink."));
-        assertTrue(PARENT_FIRST_PACKAGES.contains("javax.annotation."));
+    void testAllCorePatterns() {
+        assertThat(PARENT_FIRST_PACKAGES).contains("java.");
+        assertThat(PARENT_FIRST_PACKAGES).contains("org.apache.flink.");
+        assertThat(PARENT_FIRST_PACKAGES).contains("javax.annotation.");
     }
 
     /**
@@ -48,12 +46,12 @@ public class ParentFirstPatternsTest extends TestLogger {
      * parent-first.
      */
     @Test
-    public void testLoggersParentFirst() {
-        assertTrue(PARENT_FIRST_PACKAGES.contains("org.slf4j"));
-        assertTrue(PARENT_FIRST_PACKAGES.contains("org.apache.log4j"));
-        assertTrue(PARENT_FIRST_PACKAGES.contains("org.apache.logging"));
-        
assertTrue(PARENT_FIRST_PACKAGES.contains("org.apache.commons.logging"));
-        assertTrue(PARENT_FIRST_PACKAGES.contains("ch.qos.logback"));
+    void testLoggersParentFirst() {
+        assertThat(PARENT_FIRST_PACKAGES).contains("org.slf4j");
+        assertThat(PARENT_FIRST_PACKAGES).contains("org.apache.log4j");
+        assertThat(PARENT_FIRST_PACKAGES).contains("org.apache.logging");
+        
assertThat(PARENT_FIRST_PACKAGES).contains("org.apache.commons.logging");
+        assertThat(PARENT_FIRST_PACKAGES).contains("ch.qos.logback");
     }
 
     /**
@@ -61,8 +59,8 @@ public class ParentFirstPatternsTest extends TestLogger {
      * to load all Scala classes parent-first.
      */
     @Test
-    public void testScalaParentFirst() {
-        assertTrue(PARENT_FIRST_PACKAGES.contains("scala."));
+    void testScalaParentFirst() {
+        assertThat(PARENT_FIRST_PACKAGES).contains("scala.");
     }
 
     /**
@@ -70,7 +68,7 @@ public class ParentFirstPatternsTest extends TestLogger {
      * sink), we need to make them parent first.
      */
     @Test
-    public void testHadoopParentFirst() {
-        assertTrue(PARENT_FIRST_PACKAGES.contains("org.apache.hadoop."));
+    void testHadoopParentFirst() {
+        assertThat(PARENT_FIRST_PACKAGES).contains("org.apache.hadoop.");
     }
 }
diff --git 
a/flink-core/src/test/java/org/apache/flink/configuration/ReadableWritableConfigurationTest.java
 
b/flink-core/src/test/java/org/apache/flink/configuration/ReadableWritableConfigurationTest.java
index a2cb129c959..e5af433a566 100644
--- 
a/flink-core/src/test/java/org/apache/flink/configuration/ReadableWritableConfigurationTest.java
+++ 
b/flink-core/src/test/java/org/apache/flink/configuration/ReadableWritableConfigurationTest.java
@@ -38,8 +38,7 @@ import java.util.Objects;
 import java.util.Optional;
 import java.util.stream.Collectors;
 
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.junit.Assert.assertThat;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /**
  * Tests read access ({@link ReadableConfig}) to {@link Configuration}. There 
are 4 different test
@@ -56,10 +55,10 @@ import static org.junit.Assert.assertThat;
  * </ol>
  */
 @ExtendWith(ParameterizedTestExtension.class)
-public class ReadableWritableConfigurationTest {
+class ReadableWritableConfigurationTest {
 
     @Parameters(name = "testSpec = {0}, standardYaml = {1}")
-    public static Collection<Object[]> parameters() {
+    private static Collection<Object[]> parameters() {
         List<TestSpec<?>> testSpecs =
                 Arrays.asList(
                         new 
TestSpec<>(ConfigOptions.key("int").intType().defaultValue(-1))
@@ -142,7 +141,9 @@ public class ReadableWritableConfigurationTest {
                                                         Arrays.asList(
                                                                 
Tuple2.of("key1", "value1"),
                                                                 
Tuple2.of("key2", "value2"))),
-                                                
asMap(Arrays.asList(Tuple2.of("key3", "value3")))),
+                                                asMap(
+                                                        
Collections.singletonList(
+                                                                
Tuple2.of("key3", "value3")))),
                                         "key1:value1,key2:value2;key3:value3",
                                         "[{key1: value1, key2: value2}, {key3: 
value3}]")
                                 
.checkDefaultOverride(Collections.emptyList()));
@@ -169,7 +170,7 @@ public class ReadableWritableConfigurationTest {
         testSpec.setValue(configuration);
 
         Optional<?> optional = configuration.getOptional(testSpec.getOption());
-        assertThat(optional.get(), equalTo(testSpec.getValue()));
+        assertThat(optional.get()).isEqualTo(testSpec.getValue());
     }
 
     @TestTemplate
@@ -179,7 +180,7 @@ public class ReadableWritableConfigurationTest {
         configuration.setString(option.key(), 
testSpec.getStringValue(standardYaml));
 
         Optional<?> optional = configuration.getOptional(option);
-        assertThat(optional.get(), equalTo(testSpec.getValue()));
+        assertThat(optional).isPresent().get().isEqualTo(testSpec.getValue());
     }
 
     @TestTemplate
@@ -188,7 +189,7 @@ public class ReadableWritableConfigurationTest {
 
         ConfigOption<?> option = testSpec.getOption();
         Object value = configuration.get(option);
-        assertThat(value, equalTo(option.defaultValue()));
+        assertThat(value).isEqualTo(option.defaultValue());
     }
 
     @TestTemplate
@@ -200,7 +201,7 @@ public class ReadableWritableConfigurationTest {
         Object value =
                 ((Optional<Object>) configuration.getOptional(option))
                         .orElse(testSpec.getDefaultValueOverride());
-        assertThat(value, equalTo(testSpec.getDefaultValueOverride()));
+        assertThat(value).isEqualTo(testSpec.getDefaultValueOverride());
     }
 
     private static class TestSpec<T> {
diff --git 
a/flink-core/src/test/java/org/apache/flink/configuration/RestOptionsTest.java 
b/flink-core/src/test/java/org/apache/flink/configuration/RestOptionsTest.java
index 337a5030ea3..211a0d59ab5 100644
--- 
a/flink-core/src/test/java/org/apache/flink/configuration/RestOptionsTest.java
+++ 
b/flink-core/src/test/java/org/apache/flink/configuration/RestOptionsTest.java
@@ -18,36 +18,32 @@
 
 package org.apache.flink.configuration;
 
-import org.apache.flink.util.TestLogger;
+import org.junit.jupiter.api.Test;
 
-import org.junit.Test;
-
-import static org.hamcrest.Matchers.equalTo;
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /** Tests for the {@link RestOptions}. */
-public class RestOptionsTest extends TestLogger {
+class RestOptionsTest {
 
     @Test
-    public void testBindAddressFirstDeprecatedKey() {
+    void testBindAddressFirstDeprecatedKey() {
         final Configuration configuration = new Configuration();
         final String expectedAddress = "foobar";
         configuration.setString("web.address", expectedAddress);
 
         final String actualAddress = 
configuration.get(RestOptions.BIND_ADDRESS);
 
-        assertThat(actualAddress, is(equalTo(expectedAddress)));
+        assertThat(actualAddress).isEqualTo(expectedAddress);
     }
 
     @Test
-    public void testBindAddressSecondDeprecatedKey() {
+    void testBindAddressSecondDeprecatedKey() {
         final Configuration configuration = new Configuration();
         final String expectedAddress = "foobar";
         configuration.setString("jobmanager.web.address", expectedAddress);
 
         final String actualAddress = 
configuration.get(RestOptions.BIND_ADDRESS);
 
-        assertThat(actualAddress, is(equalTo(expectedAddress)));
+        assertThat(actualAddress).isEqualTo(expectedAddress);
     }
 }
diff --git 
a/flink-core/src/test/java/org/apache/flink/configuration/SecurityOptionsTest.java
 
b/flink-core/src/test/java/org/apache/flink/configuration/SecurityOptionsTest.java
index e74b4425fad..aa7a6fab81d 100644
--- 
a/flink-core/src/test/java/org/apache/flink/configuration/SecurityOptionsTest.java
+++ 
b/flink-core/src/test/java/org/apache/flink/configuration/SecurityOptionsTest.java
@@ -17,40 +17,37 @@
 
 package org.apache.flink.configuration;
 
-import org.apache.flink.util.TestLogger;
+import org.junit.jupiter.api.Test;
 
-import org.junit.Test;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /** Tests for the {@link SecurityOptions}. */
-public class SecurityOptionsTest extends TestLogger {
+class SecurityOptionsTest {
 
     /** Tests whether activation of internal / REST SSL evaluates the config 
flags correctly. */
     @SuppressWarnings("deprecation")
     @Test
-    public void checkEnableSSL() {
+    void checkEnableSSL() {
         // backwards compatibility
         Configuration oldConf = new Configuration();
         oldConf.set(SecurityOptions.SSL_ENABLED, true);
-        assertTrue(SecurityOptions.isInternalSSLEnabled(oldConf));
-        assertTrue(SecurityOptions.isRestSSLEnabled(oldConf));
+        assertThat(SecurityOptions.isInternalSSLEnabled(oldConf)).isTrue();
+        assertThat(SecurityOptions.isRestSSLEnabled(oldConf)).isTrue();
 
         // new options take precedence
         Configuration newOptions = new Configuration();
         newOptions.set(SecurityOptions.SSL_INTERNAL_ENABLED, true);
         newOptions.set(SecurityOptions.SSL_REST_ENABLED, false);
-        assertTrue(SecurityOptions.isInternalSSLEnabled(newOptions));
-        assertFalse(SecurityOptions.isRestSSLEnabled(newOptions));
+        assertThat(SecurityOptions.isInternalSSLEnabled(newOptions)).isTrue();
+        assertThat(SecurityOptions.isRestSSLEnabled(newOptions)).isFalse();
 
         // new options take precedence
         Configuration precedence = new Configuration();
         precedence.set(SecurityOptions.SSL_ENABLED, true);
         precedence.set(SecurityOptions.SSL_INTERNAL_ENABLED, false);
         precedence.set(SecurityOptions.SSL_REST_ENABLED, false);
-        assertFalse(SecurityOptions.isInternalSSLEnabled(precedence));
-        assertFalse(SecurityOptions.isRestSSLEnabled(precedence));
+        assertThat(SecurityOptions.isInternalSSLEnabled(precedence)).isFalse();
+        assertThat(SecurityOptions.isRestSSLEnabled(precedence)).isFalse();
     }
 
     /**
@@ -58,21 +55,21 @@ public class SecurityOptionsTest extends TestLogger {
      * correctly.
      */
     @Test
-    public void checkEnableRestSSLAuthentication() {
+    void checkEnableRestSSLAuthentication() {
         // SSL has to be enabled
         Configuration noSSLOptions = new Configuration();
         noSSLOptions.set(SecurityOptions.SSL_REST_ENABLED, false);
         noSSLOptions.set(SecurityOptions.SSL_REST_AUTHENTICATION_ENABLED, 
true);
-        
assertFalse(SecurityOptions.isRestSSLAuthenticationEnabled(noSSLOptions));
+        
assertThat(SecurityOptions.isRestSSLAuthenticationEnabled(noSSLOptions)).isFalse();
 
         // authentication is disabled by default
         Configuration defaultOptions = new Configuration();
         defaultOptions.set(SecurityOptions.SSL_REST_ENABLED, true);
-        
assertFalse(SecurityOptions.isRestSSLAuthenticationEnabled(defaultOptions));
+        
assertThat(SecurityOptions.isRestSSLAuthenticationEnabled(defaultOptions)).isFalse();
 
         Configuration options = new Configuration();
         options.set(SecurityOptions.SSL_REST_ENABLED, true);
         options.set(SecurityOptions.SSL_REST_AUTHENTICATION_ENABLED, true);
-        assertTrue(SecurityOptions.isRestSSLAuthenticationEnabled(options));
+        
assertThat(SecurityOptions.isRestSSLAuthenticationEnabled(options)).isTrue();
     }
 }
diff --git 
a/flink-core/src/test/java/org/apache/flink/configuration/StructuredOptionsSplitterEscapeTest.java
 
b/flink-core/src/test/java/org/apache/flink/configuration/StructuredOptionsSplitterEscapeTest.java
index 357bcd53927..187ed9d86b5 100644
--- 
a/flink-core/src/test/java/org/apache/flink/configuration/StructuredOptionsSplitterEscapeTest.java
+++ 
b/flink-core/src/test/java/org/apache/flink/configuration/StructuredOptionsSplitterEscapeTest.java
@@ -18,20 +18,24 @@
 
 package org.apache.flink.configuration;
 
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+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.jupiter.api.TestTemplate;
+import org.junit.jupiter.api.extension.ExtendWith;
 
 import java.util.Arrays;
 import java.util.Collection;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 /** Tests for {@link StructuredOptionsSplitter#escapeWithSingleQuote}. */
-@RunWith(Parameterized.class)
-public class StructuredOptionsSplitterEscapeTest {
+@ExtendWith(ParameterizedTestExtension.class)
+class StructuredOptionsSplitterEscapeTest {
 
-    @Parameterized.Parameters(name = "{0}")
-    public static Collection<TestSpec> getEncodeSpecs() {
+    @Parameters(name = "testSpec = {0}")
+    private static Collection<TestSpec> getEncodeSpecs() {
         return Arrays.asList(
                 TestSpec.encode("A,B,C,D", ";").expect("A,B,C,D"),
                 TestSpec.encode("A;BCD", ";").expect("'A;BCD'"),
@@ -46,14 +50,14 @@ public class StructuredOptionsSplitterEscapeTest {
                 TestSpec.encode("A;B;C:D", ",", ":").expect("'A;B;C:D'"));
     }
 
-    @Parameterized.Parameter public TestSpec testSpec;
+    @Parameter private TestSpec testSpec;
 
-    @Test
-    public void testEscapeWithSingleQuote() {
+    @TestTemplate
+    void testEscapeWithSingleQuote() {
         String encoded =
                 StructuredOptionsSplitter.escapeWithSingleQuote(
                         testSpec.getString(), testSpec.getEscapeChars());
-        Assert.assertEquals(testSpec.getEncodedString(), encoded);
+        assertThat(encoded).isEqualTo(testSpec.getEncodedString());
     }
 
     private static class TestSpec {
diff --git 
a/flink-core/src/test/java/org/apache/flink/configuration/StructuredOptionsSplitterTest.java
 
b/flink-core/src/test/java/org/apache/flink/configuration/StructuredOptionsSplitterTest.java
index 10fbfb43d11..cec4e183193 100644
--- 
a/flink-core/src/test/java/org/apache/flink/configuration/StructuredOptionsSplitterTest.java
+++ 
b/flink-core/src/test/java/org/apache/flink/configuration/StructuredOptionsSplitterTest.java
@@ -18,11 +18,12 @@
 
 package org.apache.flink.configuration;
 
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+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.jupiter.api.TestTemplate;
+import org.junit.jupiter.api.extension.ExtendWith;
 
 import javax.annotation.Nullable;
 
@@ -32,17 +33,15 @@ import java.util.List;
 import java.util.Optional;
 import java.util.stream.Collectors;
 
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.junit.Assert.assertThat;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 /** Tests for {@link StructuredOptionsSplitter}. */
-@RunWith(Parameterized.class)
-public class StructuredOptionsSplitterTest {
-
-    @Rule public ExpectedException thrown = ExpectedException.none();
+@ExtendWith(ParameterizedTestExtension.class)
+class StructuredOptionsSplitterTest {
 
-    @Parameterized.Parameters(name = "{0}")
-    public static Collection<TestSpec> getSpecs() {
+    @Parameters(name = "testSpec = {0}")
+    private static Collection<TestSpec> getSpecs() {
         return Arrays.asList(
 
                 // Use single quotes for quoting
@@ -94,21 +93,26 @@ public class StructuredOptionsSplitterTest {
                 TestSpec.split("' A    ;B'    ;'   C'", ';').expect(" A    
;B", "   C"));
     }
 
-    @Parameterized.Parameter public TestSpec testSpec;
+    @Parameter private TestSpec testSpec;
 
-    @Test
-    public void testParse() {
-        testSpec.getExpectedException()
-                .ifPresent(
-                        exception -> {
-                            thrown.expect(IllegalArgumentException.class);
-                            thrown.expectMessage(exception);
-                        });
+    @TestTemplate
+    void testParse() {
+
+        Optional<String> expectedException = testSpec.getExpectedException();
+        if (expectedException.isPresent()) {
+            assertThatThrownBy(
+                            () ->
+                                    StructuredOptionsSplitter.splitEscaped(
+                                            testSpec.getString(), 
testSpec.getDelimiter()))
+                    .isInstanceOf(IllegalArgumentException.class)
+                    .hasMessageContaining(expectedException.get());
+            return;
+        }
         List<String> splits =
                 StructuredOptionsSplitter.splitEscaped(
                         testSpec.getString(), testSpec.getDelimiter());
 
-        assertThat(splits, equalTo(testSpec.getExpectedSplits()));
+        assertThat(splits).isEqualTo(testSpec.getExpectedSplits());
     }
 
     private static class TestSpec {
diff --git 
a/flink-core/src/test/java/org/apache/flink/configuration/UnmodifiableConfigurationTest.java
 
b/flink-core/src/test/java/org/apache/flink/configuration/UnmodifiableConfigurationTest.java
index 09bb6780446..5e175936349 100644
--- 
a/flink-core/src/test/java/org/apache/flink/configuration/UnmodifiableConfigurationTest.java
+++ 
b/flink-core/src/test/java/org/apache/flink/configuration/UnmodifiableConfigurationTest.java
@@ -18,82 +18,65 @@
 
 package org.apache.flink.configuration;
 
-import org.apache.flink.util.TestLogger;
-
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.HashMap;
 import java.util.Map;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-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;
 
 /**
  * This class verifies that the Unmodifiable Configuration class overrides all 
setter methods in
  * Configuration.
  */
-public class UnmodifiableConfigurationTest extends TestLogger {
+class UnmodifiableConfigurationTest {
 
     @Test
-    public void testOverrideAddMethods() {
-        try {
-            Class<UnmodifiableConfiguration> clazz = 
UnmodifiableConfiguration.class;
-            for (Method m : clazz.getMethods()) {
-                if (m.getName().startsWith("add")) {
-                    assertEquals(clazz, m.getDeclaringClass());
-                }
+    void testOverrideAddMethods() {
+        Class<UnmodifiableConfiguration> clazz = 
UnmodifiableConfiguration.class;
+        for (Method m : clazz.getMethods()) {
+            if (m.getName().startsWith("add")) {
+                assertThat(m.getDeclaringClass()).isEqualTo(clazz);
             }
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail(e.getMessage());
         }
     }
 
     @Test
-    public void testExceptionOnSet() {
-        try {
-            @SuppressWarnings("rawtypes")
-            final ConfigOption rawOption = 
ConfigOptions.key("testkey").defaultValue("value");
+    void testExceptionOnSet() {
+        @SuppressWarnings("rawtypes")
+        final ConfigOption rawOption = 
ConfigOptions.key("testkey").defaultValue("value");
 
-            Map<Class<?>, Object> parameters = new HashMap<>();
-            parameters.put(byte[].class, new byte[0]);
-            parameters.put(Class.class, Object.class);
-            parameters.put(int.class, 0);
-            parameters.put(long.class, 0L);
-            parameters.put(float.class, 0.0f);
-            parameters.put(double.class, 0.0);
-            parameters.put(String.class, "");
-            parameters.put(boolean.class, false);
+        Map<Class<?>, Object> parameters = new HashMap<>();
+        parameters.put(byte[].class, new byte[0]);
+        parameters.put(Class.class, Object.class);
+        parameters.put(int.class, 0);
+        parameters.put(long.class, 0L);
+        parameters.put(float.class, 0.0f);
+        parameters.put(double.class, 0.0);
+        parameters.put(String.class, "");
+        parameters.put(boolean.class, false);
 
-            Class<UnmodifiableConfiguration> clazz = 
UnmodifiableConfiguration.class;
-            UnmodifiableConfiguration config = new 
UnmodifiableConfiguration(new Configuration());
+        Class<UnmodifiableConfiguration> clazz = 
UnmodifiableConfiguration.class;
+        UnmodifiableConfiguration config = new UnmodifiableConfiguration(new 
Configuration());
 
-            for (Method m : clazz.getMethods()) {
-                // ignore WritableConfig#set as it is covered in 
ReadableWritableConfigurationTest
-                if (m.getName().startsWith("set") && 
!m.getName().equals("set")) {
+        for (Method m : clazz.getMethods()) {
+            // ignore WritableConfig#set as it is covered in 
ReadableWritableConfigurationTest
+            if (m.getName().startsWith("set") && !m.getName().equals("set")) {
 
-                    Class<?> keyClass = m.getParameterTypes()[0];
-                    Class<?> parameterClass = m.getParameterTypes()[1];
-                    Object key = keyClass == String.class ? "key" : rawOption;
+                Class<?> keyClass = m.getParameterTypes()[0];
+                Class<?> parameterClass = m.getParameterTypes()[1];
+                Object key = keyClass == String.class ? "key" : rawOption;
 
-                    Object parameter = parameters.get(parameterClass);
-                    assertNotNull("method " + m + " not covered by test", 
parameter);
+                Object parameter = parameters.get(parameterClass);
+                assertThat(parameter).as("method " + m + " not covered by 
test").isNotNull();
 
-                    try {
-                        m.invoke(config, key, parameter);
-                        fail("should fail with an exception");
-                    } catch (InvocationTargetException e) {
-                        assertTrue(e.getTargetException() instanceof 
UnsupportedOperationException);
-                    }
-                }
+                assertThatThrownBy(() -> m.invoke(config, key, parameter))
+                        .isInstanceOf(InvocationTargetException.class)
+                        
.hasCauseInstanceOf(UnsupportedOperationException.class);
             }
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail(e.getMessage());
         }
     }
 }
diff --git 
a/flink-core/src/test/java/org/apache/flink/configuration/YamlParserUtilsTest.java
 
b/flink-core/src/test/java/org/apache/flink/configuration/YamlParserUtilsTest.java
index df22563c474..dc684e35690 100644
--- 
a/flink-core/src/test/java/org/apache/flink/configuration/YamlParserUtilsTest.java
+++ 
b/flink-core/src/test/java/org/apache/flink/configuration/YamlParserUtilsTest.java
@@ -20,7 +20,6 @@ package org.apache.flink.configuration;
 
 import org.apache.flink.util.ExceptionUtils;
 
-import org.assertj.core.api.Assertions;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.io.TempDir;
 import org.snakeyaml.engine.v2.exceptions.YamlEngineException;
@@ -60,18 +59,18 @@ class YamlParserUtilsTest {
 
         Map<String, Object> yamlData = YamlParserUtils.loadYamlFile(confFile);
         assertThat(yamlData).isNotNull();
-        assertThat(yamlData.get("key1")).isEqualTo("value1");
+        assertThat(yamlData).containsEntry("key1", "value1");
         assertThat(((Map<?, ?>) 
yamlData.get("key2")).get("subKey1")).isEqualTo("value2");
-        assertThat(yamlData.get("key3")).isEqualTo(Arrays.asList("a", "b", 
"c"));
+        assertThat(yamlData).containsEntry("key3", Arrays.asList("a", "b", 
"c"));
 
         Map<String, String> map = new HashMap<>();
         map.put("k1", "v1");
         map.put("k2", "v2");
         map.put("k3", "v3");
-        assertThat(yamlData.get("key4")).isEqualTo(map);
-        assertThat(yamlData.get("key5")).isEqualTo("*");
+        assertThat(yamlData).containsEntry("key4", map);
+        assertThat(yamlData).containsEntry("key5", "*");
         assertThat((Boolean) yamlData.get("key6")).isTrue();
-        assertThat(yamlData.get("key7")).isEqualTo("true");
+        assertThat(yamlData).containsEntry("key7", "true");
     }
 
     /**
@@ -150,7 +149,7 @@ class YamlParserUtilsTest {
                 .isInstanceOf(YamlEngineException.class)
                 .satisfies(
                         e ->
-                                
Assertions.assertThat(ExceptionUtils.stringifyException(e))
+                                
assertThat(ExceptionUtils.stringifyException(e))
                                         .doesNotContain("secret"));
     }
 
@@ -167,7 +166,7 @@ class YamlParserUtilsTest {
                 .isInstanceOf(YamlEngineException.class)
                 .satisfies(
                         e ->
-                                
Assertions.assertThat(ExceptionUtils.stringifyException(e))
+                                
assertThat(ExceptionUtils.stringifyException(e))
                                         .doesNotContain("secret1", "secret2"));
     }
 
diff --git 
a/flink-core/src/test/java/org/apache/flink/configuration/description/DescriptionHtmlTest.java
 
b/flink-core/src/test/java/org/apache/flink/configuration/description/DescriptionHtmlTest.java
index 09fb8a43197..4b01a87795c 100644
--- 
a/flink-core/src/test/java/org/apache/flink/configuration/description/DescriptionHtmlTest.java
+++ 
b/flink-core/src/test/java/org/apache/flink/configuration/description/DescriptionHtmlTest.java
@@ -18,16 +18,16 @@
 
 package org.apache.flink.configuration.description;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import static org.apache.flink.configuration.description.LinkElement.link;
 import static org.apache.flink.configuration.description.TextElement.text;
-import static org.junit.Assert.assertEquals;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /** Tests for {@link Description} and formatting with {@link HtmlFormatter}. */
-public class DescriptionHtmlTest {
+class DescriptionHtmlTest {
     @Test
-    public void testDescriptionWithLink() {
+    void testDescriptionWithLink() {
         Description description =
                 Description.builder()
                         .text("This is a text with a link %s", 
link("https://somepage";, "to here"))
@@ -35,13 +35,13 @@ public class DescriptionHtmlTest {
 
         String formattedDescription = new HtmlFormatter().format(description);
 
-        assertEquals(
-                "This is a text with a link <a href=\"https://somepage\";>" + 
"to here</a>",
-                formattedDescription);
+        assertThat(formattedDescription)
+                .isEqualTo(
+                        "This is a text with a link <a 
href=\"https://somepage\";>" + "to here</a>");
     }
 
     @Test
-    public void testDescriptionWithPercents() {
+    void testDescriptionWithPercents() {
         Description description =
                 Description.builder()
                         .text("This is a text that has some percentage value 
of 20%.")
@@ -49,11 +49,12 @@ public class DescriptionHtmlTest {
 
         String formattedDescription = new HtmlFormatter().format(description);
 
-        assertEquals("This is a text that has some percentage value of 20%.", 
formattedDescription);
+        assertThat(formattedDescription)
+                .isEqualTo("This is a text that has some percentage value of 
20%.");
     }
 
     @Test
-    public void testDescriptionWithMultipleLinks() {
+    void testDescriptionWithMultipleLinks() {
         Description description =
                 Description.builder()
                         .text(
@@ -63,14 +64,14 @@ public class DescriptionHtmlTest {
 
         String formattedDescription = new HtmlFormatter().format(description);
 
-        assertEquals(
-                "This is a text with a link <a href=\"https://somepage\";>to 
here</a> and another "
-                        + "<a href=\"https://link\";>https://link</a>",
-                formattedDescription);
+        assertThat(formattedDescription)
+                .isEqualTo(
+                        "This is a text with a link <a 
href=\"https://somepage\";>to here</a> and another "
+                                + "<a href=\"https://link\";>https://link</a>");
     }
 
     @Test
-    public void testDescriptionWithList() {
+    void testDescriptionWithList() {
         Description description =
                 Description.builder()
                         .text("This is some list: ")
@@ -83,15 +84,15 @@ public class DescriptionHtmlTest {
 
         String formattedDescription = new HtmlFormatter().format(description);
 
-        assertEquals(
-                "This is some list: <ul><li><a 
href=\"http://first_link\";>http://first_link";
-                        + "</a></li><li>this is second element of list "
-                        + "with a <a 
href=\"https://link\";>https://link</a></li></ul>",
-                formattedDescription);
+        assertThat(formattedDescription)
+                .isEqualTo(
+                        "This is some list: <ul><li><a 
href=\"http://first_link\";>http://first_link";
+                                + "</a></li><li>this is second element of list 
"
+                                + "with a <a 
href=\"https://link\";>https://link</a></li></ul>");
     }
 
     @Test
-    public void testDescriptionWithLineBreak() {
+    void testDescriptionWithLineBreak() {
         Description description =
                 Description.builder()
                         .text("This is first line.")
@@ -101,11 +102,11 @@ public class DescriptionHtmlTest {
 
         String formattedDescription = new HtmlFormatter().format(description);
 
-        assertEquals("This is first line.<br />This is second line.", 
formattedDescription);
+        assertThat(formattedDescription).isEqualTo("This is first line.<br 
/>This is second line.");
     }
 
     @Test
-    public void testDescriptionWithListAndEscaping() {
+    void testDescriptionWithListAndEscaping() {
         Description description =
                 Description.builder()
                         .text("This is some list: ")
@@ -114,8 +115,8 @@ public class DescriptionHtmlTest {
 
         String formattedDescription = new HtmlFormatter().format(description);
 
-        assertEquals(
-                "This is some list: <ul><li>this is first element with illegal 
character '&gt;' and '&lt;'</li></ul>",
-                formattedDescription);
+        assertThat(formattedDescription)
+                .isEqualTo(
+                        "This is some list: <ul><li>this is first element with 
illegal character '&gt;' and '&lt;'</li></ul>");
     }
 }

Reply via email to