Jiabao-Sun commented on code in PR #24670: URL: https://github.com/apache/flink/pull/24670#discussion_r1593325219
########## flink-core/src/test/java/org/apache/flink/util/SerializedValueTest.java: ########## @@ -20,62 +20,57 @@ import org.apache.flink.core.testutils.CommonTestUtils; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.Arrays; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; /** Tests for the {@link SerializedValue}. */ -public class SerializedValueTest { +class SerializedValueTest { @Test - public void testSimpleValue() { - try { - final String value = "teststring"; - - SerializedValue<String> v = new SerializedValue<>(value); - SerializedValue<String> copy = CommonTestUtils.createCopySerializable(v); - - assertEquals(value, v.deserializeValue(getClass().getClassLoader())); - assertEquals(value, copy.deserializeValue(getClass().getClassLoader())); - - assertEquals(v, copy); - assertEquals(v.hashCode(), copy.hashCode()); - - assertNotNull(v.toString()); - assertNotNull(copy.toString()); - - assertNotEquals(0, v.getByteArray().length); - assertArrayEquals(v.getByteArray(), copy.getByteArray()); - - byte[] bytes = v.getByteArray(); - SerializedValue<String> saved = - SerializedValue.fromBytes(Arrays.copyOf(bytes, bytes.length)); - assertEquals(v, saved); - assertArrayEquals(v.getByteArray(), saved.getByteArray()); - } catch (Exception e) { - e.printStackTrace(); - fail(e.getMessage()); - } + void testSimpleValue() throws Exception { + final String value = "teststring"; + + SerializedValue<String> v = new SerializedValue<>(value); + SerializedValue<String> copy = CommonTestUtils.createCopySerializable(v); + + assertThat(v.deserializeValue(getClass().getClassLoader())).isEqualTo(value); + assertThat(copy.deserializeValue(getClass().getClassLoader())).isEqualTo(value); + + assertThat(copy).isEqualTo(v); + assertThat(copy).hasSameHashCodeAs(v.hashCode()); Review Comment: ```suggestion assertThat(copy).hasSameHashCodeAs(v); ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org