This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-compress.git
commit 5602d0d84b2a2e5840a69854bcec0bbb2794f766 Author: Gary Gregory <[email protected]> AuthorDate: Fri May 17 14:32:36 2024 -0400 Fix test --- .../org/apache/commons/compress/archivers/zip/ZipIoUtilTest.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ZipIoUtilTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ZipIoUtilTest.java index a963b5bf8..6c4c4f2ea 100644 --- a/src/test/java/org/apache/commons/compress/archivers/zip/ZipIoUtilTest.java +++ b/src/test/java/org/apache/commons/compress/archivers/zip/ZipIoUtilTest.java @@ -19,7 +19,9 @@ package org.apache.commons.compress.archivers.zip; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -38,8 +40,10 @@ import org.junit.jupiter.api.Test; */ public class ZipIoUtilTest extends AbstractTempDirTest { - private FileChannel mockFileChannel() { - return mock(FileChannel.class); + private FileChannel mockFileChannel() throws IOException { + final FileChannel spy = spy(FileChannel.class); + doNothing().when(spy).close(); + return spy; } private SeekableByteChannel mockSeekableByteChannel() {
