This is an automated email from the ASF dual-hosted git repository. bodewig pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-compress.git
The following commit(s) were added to refs/heads/master by this push: new efd2e84 COMPRESS-520: Implement ZCompressorInputStreamTest without powermock new 09ff001 Merge pull request #101 from theobisproject/remove-powermock efd2e84 is described below commit efd2e84f2b89d0494c444f4f227e2c390b28b520 Author: theobisproject <theobisproj...@gmail.com> AuthorDate: Sat May 16 14:11:44 2020 +0200 COMPRESS-520: Implement ZCompressorInputStreamTest without powermock --- pom.xml | 14 ++++--------- .../compressors/z/ZCompressorInputStreamTest.java | 24 +++------------------- 2 files changed, 7 insertions(+), 31 deletions(-) diff --git a/pom.xml b/pom.xml index ea245bd..7dbd7d4 100644 --- a/pom.xml +++ b/pom.xml @@ -51,7 +51,7 @@ Brotli, Zstandard and ar, cpio, jar, tar, zip, dump, 7z, arj. <commons.rc.version>RC1</commons.rc.version> <!-- old version used by japicmp --> <commons.bc.version>1.20</commons.bc.version> - <powermock.version>1.7.4</powermock.version> + <mockito.version>1.10.19</mockito.version> <commons.pmd-plugin.version>3.12.0</commons.pmd-plugin.version> <commons.manifestlocation>${project.build.outputDirectory}/META-INF</commons.manifestlocation> @@ -110,15 +110,9 @@ Brotli, Zstandard and ar, cpio, jar, tar, zip, dump, 7z, arj. <optional>true</optional> </dependency> <dependency> - <groupId>org.powermock</groupId> - <artifactId>powermock-module-junit4</artifactId> - <version>${powermock.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.powermock</groupId> - <artifactId>powermock-api-mockito</artifactId> - <version>${powermock.version}</version> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <version>${mockito.version}</version> <scope>test</scope> </dependency> diff --git a/src/test/java/org/apache/commons/compress/compressors/z/ZCompressorInputStreamTest.java b/src/test/java/org/apache/commons/compress/compressors/z/ZCompressorInputStreamTest.java index 9e7786b..fc543b8 100644 --- a/src/test/java/org/apache/commons/compress/compressors/z/ZCompressorInputStreamTest.java +++ b/src/test/java/org/apache/commons/compress/compressors/z/ZCompressorInputStreamTest.java @@ -26,13 +26,10 @@ import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.SequenceInputStream; -import java.util.Enumeration; +import java.util.Collections; import org.apache.commons.compress.utils.IOUtils; import static org.apache.commons.compress.AbstractTestCase.getFile; -import static org.mockito.Mockito.mock; -import static org.powermock.api.mockito.PowerMockito.doReturn; - /** * Unit tests for class {@link ZCompressorInputStream}. @@ -45,23 +42,8 @@ public class ZCompressorInputStreamTest { @Test(expected = IOException.class) public void testFailsToCreateZCompressorInputStreamAndThrowsIOException() throws IOException { - boolean java9 = false; - try { - Class.forName("java.lang.module.ModuleDescriptor"); - java9 = true; - } catch (Exception ex) { - // not Java9 - } - org.junit.Assume.assumeFalse("can't use PowerMock with Java9", java9); - - Enumeration<SequenceInputStream> enumeration = (Enumeration<SequenceInputStream>) mock(Enumeration.class); - SequenceInputStream sequenceInputStream = new SequenceInputStream(enumeration); - ZCompressorInputStream zCompressorInputStream = null; - - doReturn(false).when(enumeration).hasMoreElements(); - - zCompressorInputStream = new ZCompressorInputStream(sequenceInputStream); - + SequenceInputStream sequenceInputStream = new SequenceInputStream(Collections.<InputStream>emptyEnumeration()); + ZCompressorInputStream zCompressorInputStream = new ZCompressorInputStream(sequenceInputStream); } @Test