reswqa commented on code in PR #22616: URL: https://github.com/apache/flink/pull/22616#discussion_r1200346414
########## flink-core/src/test/java/org/apache/flink/api/common/io/InputStreamFSInputWrapperTest.java: ########## @@ -20,18 +20,32 @@ import org.junit.Test; +import java.io.IOException; import java.io.InputStream; +import java.util.concurrent.atomic.AtomicBoolean; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; +import static org.assertj.core.api.Assertions.assertThat; public class InputStreamFSInputWrapperTest { @Test public void testClose() throws Exception { - InputStream mockedInputStream = mock(InputStream.class); + final AtomicBoolean closeCalled = new AtomicBoolean(false); + InputStream mockedInputStream = + new InputStream() { + @Override + public int read() { + return 0; + } + + @Override + public void close() throws IOException { + closeCalled.set(true); + super.close(); + } + }; InputStreamFSInputWrapper wrapper = new InputStreamFSInputWrapper(mockedInputStream); wrapper.close(); - verify(mockedInputStream).close(); + assertThat(closeCalled.get()).isEqualTo(true); Review Comment: Maybe `assertThat(closeCalled).isTrue();` ########## flink-runtime/src/test/java/org/apache/flink/runtime/io/disk/iomanager/AsynchronousFileIOChannelTest.java: ########## @@ -47,7 +45,6 @@ import static org.junit.Assert.fail; import static org.mockito.Mockito.mock; Review Comment: nit: How about removing the remaining mocks of this class as well, It shouldn't be complicated either. -- 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