1996fanrui commented on code in PR #23218: URL: https://github.com/apache/flink/pull/23218#discussion_r1307500363
########## flink-runtime/src/test/java/org/apache/flink/runtime/state/OperatorStateOutputCheckpointStreamTest.java: ########## @@ -54,41 +55,40 @@ private OperatorStateHandle writeAllTestKeyGroups( } @Test - public void testCloseNotPropagated() throws Exception { + void testCloseNotPropagated() throws Exception { OperatorStateCheckpointOutputStream stream = createStream(); TestMemoryCheckpointOutputStream innerStream = (TestMemoryCheckpointOutputStream) stream.getDelegate(); stream.close(); - Assert.assertFalse(innerStream.isClosed()); + assertThat(innerStream.isClosed()).isFalse(); innerStream.close(); } @Test - public void testEmptyOperatorStream() throws Exception { + void testEmptyOperatorStream() throws Exception { OperatorStateCheckpointOutputStream stream = createStream(); TestMemoryCheckpointOutputStream innerStream = (TestMemoryCheckpointOutputStream) stream.getDelegate(); OperatorStateHandle emptyHandle = stream.closeAndGetHandle(); - Assert.assertTrue(innerStream.isClosed()); - Assert.assertEquals(0, stream.getNumberOfPartitions()); - Assert.assertEquals(null, emptyHandle); + assertThat(innerStream.isClosed()).isTrue(); + assertThat(stream.getNumberOfPartitions()).isZero(); + assertThat(emptyHandle).isNull(); } @Test public void testWriteReadRoundtrip() throws Exception { Review Comment: ```suggestion void testWriteReadRoundtrip() throws Exception { ``` ########## flink-runtime/src/test/java/org/apache/flink/runtime/state/filesystem/FileStateHandleTest.java: ########## @@ -147,7 +144,7 @@ public void testDiscardStateWithDeletionFailureThroughException() throws Excepti } @Test - public void testDiscardStateWithDeletionFailureThroughReturnValue() throws Exception { + void testDiscardStateWithDeletionFailureThroughReturnValue() throws Exception { Review Comment: The public of `testDiscardStateWithDeletionFailureThroughException`can be removed. And the public of `FsCheckpointStreamFactoryTest` class can be removed. ########## flink-runtime/src/test/java/org/apache/flink/runtime/state/KeyGroupsStateHandleTest.java: ########## @@ -20,28 +20,26 @@ import org.apache.flink.runtime.state.memory.ByteStreamStateHandle; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; +import static org.assertj.core.api.Assertions.assertThat; /** A test for {@link KeyGroupsStateHandle} */ -public class KeyGroupsStateHandleTest { +class KeyGroupsStateHandleTest { @Test - public void testNonEmptyIntersection() { + void testNonEmptyIntersection() { KeyGroupRangeOffsets offsets = new KeyGroupRangeOffsets(0, 7); byte[] dummy = new byte[10]; StreamStateHandle streamHandle = new ByteStreamStateHandle("test", dummy); KeyGroupsStateHandle handle = new KeyGroupsStateHandle(offsets, streamHandle); KeyGroupRange expectedRange = new KeyGroupRange(0, 3); KeyGroupsStateHandle newHandle = handle.getIntersection(expectedRange); - assertNotNull(newHandle); - assertEquals(streamHandle, newHandle.getDelegateStateHandle()); - assertEquals(expectedRange, newHandle.getKeyGroupRange()); - assertEquals(handle.getStateHandleId(), newHandle.getStateHandleId()); + assertThat(newHandle).isNotNull(); + assertThat(newHandle.getDelegateStateHandle()).isEqualTo(streamHandle); + assertThat(newHandle.getKeyGroupRange()).isEqualTo(expectedRange); + assertThat(newHandle.getStateHandleId()).isEqualTo(handle.getStateHandleId()); } @Test Review Comment: The public can be removed. -- 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